From cb6c7640c85e9a5d882dc850a3d5a20fcba650aa Mon Sep 17 00:00:00 2001 From: Calen Pennington Date: Wed, 18 Jul 2012 15:50:12 -0400 Subject: [PATCH] Get the video module pointing to the correct static files directory, without relying on get_html replacement --- common/lib/xmodule/xmodule/js/src/video/display.coffee | 2 +- .../xmodule/js/src/video/display/video_caption.coffee | 2 +- .../xmodule/js/src/video/display/video_player.coffee | 6 +++++- common/lib/xmodule/xmodule/video_module.py | 2 ++ lms/templates/video.html | 2 +- 5 files changed, 10 insertions(+), 4 deletions(-) diff --git a/common/lib/xmodule/xmodule/js/src/video/display.coffee b/common/lib/xmodule/xmodule/js/src/video/display.coffee index 0741bc657b..421e4751c5 100644 --- a/common/lib/xmodule/xmodule/js/src/video/display.coffee +++ b/common/lib/xmodule/xmodule/js/src/video/display.coffee @@ -1,7 +1,7 @@ class @Video constructor: (@element) -> @id = $(@element).attr('id').replace(/video_/, '') - @caption_url_base = $(@element).data('caption-url-base') + @caption_data_dir = $(@element).data('caption-data-dir') window.player = null @el = $("#video_#{@id}") @parseVideos $(@element).data('streams') diff --git a/common/lib/xmodule/xmodule/js/src/video/display/video_caption.coffee b/common/lib/xmodule/xmodule/js/src/video/display/video_caption.coffee index 734c2643a6..1690fb6092 100644 --- a/common/lib/xmodule/xmodule/js/src/video/display/video_caption.coffee +++ b/common/lib/xmodule/xmodule/js/src/video/display/video_caption.coffee @@ -7,7 +7,7 @@ class @VideoCaption extends Subview .bind('DOMMouseScroll', @onMovement) captionURL: -> - "#{@captionURLBase}/#{@youtubeId}.srt.sjson" + "/static/#{@captionDataDir}/subs/#{@youtubeId}.srt.sjson" render: -> @$('.video-wrapper').after """ diff --git a/common/lib/xmodule/xmodule/js/src/video/display/video_player.coffee b/common/lib/xmodule/xmodule/js/src/video/display/video_player.coffee index f840a24d90..2392be821c 100644 --- a/common/lib/xmodule/xmodule/js/src/video/display/video_player.coffee +++ b/common/lib/xmodule/xmodule/js/src/video/display/video_player.coffee @@ -25,7 +25,11 @@ class @VideoPlayer extends Subview render: -> @control = new VideoControl el: @$('.video-controls') - @caption = new VideoCaption el: @el, youtubeId: @video.youtubeId('1.0'), currentSpeed: @currentSpeed(), captionURLBase: @video.caption_url_base + @caption = new VideoCaption + el: @el + youtubeId: @video.youtubeId('1.0') + currentSpeed: @currentSpeed() + captionDataDir: @video.caption_data_dir unless onTouchBasedDevice() @volumeControl = new VideoVolumeControl el: @$('.secondary-controls') @speedControl = new VideoSpeedControl el: @$('.secondary-controls'), speeds: @video.speeds, currentSpeed: @currentSpeed() diff --git a/common/lib/xmodule/xmodule/video_module.py b/common/lib/xmodule/xmodule/video_module.py index 8e536474ed..fabb789ece 100644 --- a/common/lib/xmodule/xmodule/video_module.py +++ b/common/lib/xmodule/xmodule/video_module.py @@ -71,6 +71,8 @@ class VideoModule(XModule): 'id': self.location.html_id(), 'position': self.position, 'name': self.name, + # TODO (cpennington): This won't work when we move to data that isn't on the filesystem + 'data_dir': self.metadata['data_dir'], }) diff --git a/lms/templates/video.html b/lms/templates/video.html index df98805152..65ff44e8fa 100644 --- a/lms/templates/video.html +++ b/lms/templates/video.html @@ -2,7 +2,7 @@

${name}

% endif -
+