Get the video module pointing to the correct static files directory, without relying on get_html replacement
This commit is contained in:
@@ -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')
|
||||
|
||||
@@ -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 """
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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'],
|
||||
})
|
||||
|
||||
|
||||
|
||||
@@ -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">
|
||||
|
||||
Reference in New Issue
Block a user