Commit a29991e8 by David Ormsbee

Merge pull request #590 from MITx/feature/arjun/allow_uncaptioned_videos

Temporary fix to make uncaptioned videos display reasonably. Will replace with proper solution.
parents 30543d45 5c5d1140
...@@ -3,6 +3,7 @@ class @Video ...@@ -3,6 +3,7 @@ class @Video
@el = $(element).find('.video') @el = $(element).find('.video')
@id = @el.attr('id').replace(/video_/, '') @id = @el.attr('id').replace(/video_/, '')
@caption_data_dir = @el.data('caption-data-dir') @caption_data_dir = @el.data('caption-data-dir')
@show_captions = @el.data('show-captions') == "true"
window.player = null window.player = null
@el = $("#video_#{@id}") @el = $("#video_#{@id}")
@parseVideos @el.data('streams') @parseVideos @el.data('streams')
......
...@@ -13,8 +13,12 @@ class @VideoCaption extends Subview ...@@ -13,8 +13,12 @@ class @VideoCaption extends Subview
"/static/#{@captionDataDir}/subs/#{@youtubeId}.srt.sjson" "/static/#{@captionDataDir}/subs/#{@youtubeId}.srt.sjson"
render: -> render: ->
# TODO: make it so you can have a video with no captions.
#@$('.video-wrapper').after """
# <ol class="subtitles"><li>Attempting to load captions...</li></ol>
# """
@$('.video-wrapper').after """ @$('.video-wrapper').after """
<ol class="subtitles"><li>Attempting to load captions...</li></ol> <ol class="subtitles"></ol>
""" """
@$('.video-controls .secondary-controls').append """ @$('.video-controls .secondary-controls').append """
<a href="#" class="hide-subtitles" title="Turn off captions">Captions</a> <a href="#" class="hide-subtitles" title="Turn off captions">Captions</a>
......
...@@ -30,6 +30,7 @@ class VideoModule(XModule): ...@@ -30,6 +30,7 @@ class VideoModule(XModule):
xmltree = etree.fromstring(self.definition['data']) xmltree = etree.fromstring(self.definition['data'])
self.youtube = xmltree.get('youtube') self.youtube = xmltree.get('youtube')
self.position = 0 self.position = 0
self.show_captions = xmltree.get('show_captions', 'true')
if instance_state is not None: if instance_state is not None:
state = json.loads(instance_state) state = json.loads(instance_state)
...@@ -75,6 +76,7 @@ class VideoModule(XModule): ...@@ -75,6 +76,7 @@ class VideoModule(XModule):
'display_name': self.display_name, 'display_name': self.display_name,
# TODO (cpennington): This won't work when we move to data that isn't on the filesystem # TODO (cpennington): This won't work when we move to data that isn't on the filesystem
'data_dir': self.metadata['data_dir'], 'data_dir': self.metadata['data_dir'],
'show_captions': self.show_captions
}) })
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<h2> ${display_name} </h2> <h2> ${display_name} </h2>
% endif % endif
<div id="video_${id}" class="video" data-streams="${streams}" data-caption-data-dir="${data_dir}"> <div id="video_${id}" class="video" data-streams="${streams}" data-caption-data-dir="${data_dir}" data-show-captions="${show_captions}">
<div class="tc-wrapper"> <div class="tc-wrapper">
<article class="video-wrapper"> <article class="video-wrapper">
<section class="video-player"> <section class="video-player">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment