Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
daed2f46
Commit
daed2f46
authored
Jun 15, 2012
by
Bridger Maxwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Captions now play from the Amara API. All videos show the same caption though.
parent
788321be
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
11 deletions
+21
-11
lms/static/coffee/src/modules/video/video_caption.coffee
+21
-11
No files found.
lms/static/coffee/src/modules/video/video_caption.coffee
View file @
daed2f46
...
...
@@ -17,7 +17,8 @@ class @VideoCaption
.
bind
(
'DOMMouseScroll'
,
@
onMovement
)
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
:
->
@
$
(
'.video-wrapper'
).
after
"""
...
...
@@ -30,15 +31,24 @@ class @VideoCaption
@
fetchCaption
()
fetchCaption
:
->
$
.
getWithPrefix
@
captionURL
(),
(
captions
)
=>
@
captions
=
captions
.
text
@
start
=
captions
.
start
if
onTouchBasedDevice
()
$
(
'.subtitles li'
).
html
"Caption will be displayed when you start playing the video."
else
@
renderCaption
()
$
.
ajax
dataType
:
'jsonp'
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
()
$
(
'.subtitles li'
).
html
"Caption will be displayed when you start playing the video."
else
@
renderCaption
()
renderCaption
:
->
container
=
$
(
'<ol>'
)
...
...
@@ -59,7 +69,7 @@ class @VideoCaption
search
:
(
time
)
->
min
=
0
max
=
@
start
.
length
-
1
while
min
<
max
index
=
Math
.
ceil
((
max
+
min
)
/
2
)
if
time
<
@
start
[
index
]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment