Get the video module pointing to the correct static files directory, without relying on get_html replacement

This commit is contained in:
Calen Pennington
2012-07-18 15:50:12 -04:00
parent 19a3c14ab9
commit cb6c7640c8
5 changed files with 10 additions and 4 deletions

View File

@@ -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')

View File

@@ -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 """

View File

@@ -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()

View File

@@ -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'],
})

View File

@@ -2,7 +2,7 @@
<h1> ${name} </h1>
% endif
<div id="video_${id}" class="video" data-streams="${streams}" data-caption-url-base="/static/subs">
<div id="video_${id}" class="video" data-streams="${streams}" data-caption-data-dir="${data_dir}">
<div class="tc-wrapper">
<article class="video-wrapper">
<section class="video-player">