Commit daed2f46 by Bridger Maxwell

Captions now play from the Amara API. All videos show the same caption though.

parent 788321be
...@@ -17,7 +17,8 @@ class @VideoCaption ...@@ -17,7 +17,8 @@ class @VideoCaption
.bind('DOMMouseScroll', @onMovement) .bind('DOMMouseScroll', @onMovement)
captionURL: -> captionURL: ->
"/static/subs/#{@youtubeId}.srt.sjson" "http://www.universalsubtitles.org/api/1.0/subtitles/?video_url=http://www.youtube.com/watch?v=69rDtSpshAw"
# "/static/subs/#{@youtubeId}.srt.sjson"
render: -> render: ->
@$('.video-wrapper').after """ @$('.video-wrapper').after """
...@@ -30,10 +31,19 @@ class @VideoCaption ...@@ -30,10 +31,19 @@ class @VideoCaption
@fetchCaption() @fetchCaption()
fetchCaption: -> fetchCaption: ->
$.getWithPrefix @captionURL(), (captions) => $.ajax
@captions = captions.text dataType: 'jsonp'
@start = captions.start url: @captionURL()
success: (captions) =>
# We take the captions that are each in a dictionary with a key,
# and create two arrays. One with all the start times, and one with
# all the texts. Their indices correspond.
@captions = []
@start = []
record = (single_caption) =>
@captions.push single_caption.text
@start.push single_caption.start_time * 1000
record single_caption for single_caption in captions
if onTouchBasedDevice() if onTouchBasedDevice()
$('.subtitles li').html "Caption will be displayed when you start playing the video." $('.subtitles li').html "Caption will be displayed when you start playing the video."
else else
......
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