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
baf6bbe3
Commit
baf6bbe3
authored
Feb 04, 2013
by
Valera Rozuvan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Finalized HTML5 YouTube player inbrowser speed changes.
parent
143217d6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
14 additions
and
23 deletions
+14
-23
common/lib/xmodule/xmodule/js/src/videoalpha/display.coffee
+6
-6
common/lib/xmodule/xmodule/js/src/videoalpha/display/html5_video.js
+0
-0
common/lib/xmodule/xmodule/js/src/videoalpha/display/video_player.coffee
+6
-9
common/lib/xmodule/xmodule/js/src/videoalpha/display/video_speed_control.coffee
+2
-8
No files found.
common/lib/xmodule/xmodule/js/src/videoalpha/display.coffee
View file @
baf6bbe3
...
...
@@ -25,7 +25,7 @@ class @VideoAlpha
"1.0"
:
sub
"1.25"
:
sub
"1.5"
:
sub
@
setSpeed
(
$
.
cookie
(
'video_speed'
)
)
@
setSpeed
$
.
cookie
(
'video_speed'
)
$
(
"#video_
#{
@
id
}
"
).
data
(
'video'
,
this
).
addClass
(
'video-load-complete'
)
if
@
show_captions
is
true
@
hide_captions
=
$
.
cookie
(
'hide_captions'
)
==
'true'
...
...
@@ -47,7 +47,7 @@ class @VideoAlpha
youtubeId
:
(
speed
)
->
@
videos
[
speed
||
@
speed
]
VideoAlpha
::
parseVideos
=
(
videos
)
->
parseVideos
:
(
videos
)
->
return
false
if
(
typeof
videos
isnt
"string"
)
or
(
videos
.
length
is
0
)
@
videos
=
{}
_this
=
this
...
...
@@ -58,7 +58,7 @@ class @VideoAlpha
_this
.
videos
[
speed
]
=
video
[
1
]
true
VideoAlpha
::
parseVideoSources
=
(
mp4Source
,
webmSource
,
oggSource
)
->
parseVideoSources
:
(
mp4Source
,
webmSource
,
oggSource
)
->
@
html5Sources
=
mp4
:
null
webm
:
null
...
...
@@ -69,9 +69,9 @@ class @VideoAlpha
parseSpeed
:
->
@
speeds
=
(
$
.
map
@
videos
,
(
url
,
speed
)
->
speed
).
sort
()
@
setSpeed
(
$
.
cookie
(
'video_speed'
)
)
@
setSpeed
$
.
cookie
(
'video_speed'
)
VideoAlpha
::
setSpeed
=
(
newSpeed
)
->
setSpeed
:
(
newSpeed
)
->
if
@
speeds
.
indexOf
(
newSpeed
)
isnt
-
1
@
speed
=
newSpeed
$
.
cookie
"video_speed"
,
""
+
newSpeed
,
...
...
@@ -91,7 +91,7 @@ class @VideoAlpha
getDuration
:
->
@
metadata
[
@
youtubeId
()].
duration
VideoAlpha
::
log
=
(
eventName
)
->
log
:
(
eventName
)
->
logInfo
=
id
:
@
id
code
:
@
youtubeId
()
...
...
common/lib/xmodule/xmodule/js/src/videoalpha/display/html5_video.js
View file @
baf6bbe3
This diff is collapsed.
Click to expand it.
common/lib/xmodule/xmodule/js/src/videoalpha/display/video_player.coffee
View file @
baf6bbe3
...
...
@@ -94,19 +94,16 @@ class @VideoPlayerAlpha extends SubviewAlpha
when
@
PlayerState
.
UNSTARTED
if
@
video
.
videoType
is
"youtube"
availableSpeeds
=
@
player
.
getAvailablePlaybackRates
()
console
.
log
@
video
.
videos
if
availableSpeeds
.
length
>
1
baseSpeedSubs
=
@
video
.
videos
[
"1.0"
]
$
.
each
@
video
.
videos
,
(
index
,
value
)
->
delete
_this
.
video
.
videos
[
index
]
@
video
.
speeds
=
[]
$
.
each
availableSpeeds
,
(
index
,
value
)
->
_this
.
video
.
videos
[
value
.
toFixed
(
2
).
replace
(
/\.00$/
,
".0"
)]
=
baseSpeedSubs
@
speedControl
.
reRender
()
console
.
log
"UNSTARTED. available speeds = "
console
.
log
availableSpeeds
_this
.
video
.
speeds
.
push
value
.
toFixed
(
2
).
replace
(
/\.00$/
,
".0"
)
@
speedControl
.
reRender
@
video
.
speeds
@
video
.
videoType
=
'html5'
@
onUnstarted
()
when
@
PlayerState
.
PLAYING
@
onPlay
()
...
...
@@ -162,12 +159,12 @@ class @VideoPlayerAlpha extends SubviewAlpha
if
@
video
.
videoType
is
'youtube'
@
currentTime
=
Time
.
convert
(
@
currentTime
,
parseFloat
(
@
currentSpeed
()),
newSpeed
)
newSpeed
=
parseFloat
(
newSpeed
).
toFixed
(
2
).
replace
/\.00$/
,
'.0'
@
video
.
setSpeed
(
newSpeed
)
@
video
.
setSpeed
newSpeed
if
@
video
.
videoType
is
'youtube'
if
@
video
.
show_captions
is
true
@
caption
.
currentSpeed
=
newSpeed
if
@
video
.
videoType
is
'html5'
@
player
.
set
Speed
(
newSpeed
)
@
player
.
set
PlaybackRate
newSpeed
else
if
@
video
.
videoType
is
'youtube'
if
@
isPlaying
()
@
player
.
loadVideoById
(
@
video
.
youtubeId
(),
@
currentTime
)
...
...
common/lib/xmodule/xmodule/js/src/videoalpha/display/video_speed_control.coffee
View file @
baf6bbe3
...
...
@@ -24,20 +24,14 @@ class @VideoSpeedControlAlpha extends SubviewAlpha
<ol class="video_speeds"></ol>
</div>
"""
$
.
each
@
speeds
,
(
index
,
speed
)
=>
link
=
$
(
'<a>'
).
attr
(
href
:
"#"
).
html
(
"
#{
speed
}
x"
)
@
$
(
'.video_speeds'
).
prepend
(
$
(
'<li>'
).
attr
(
'data-speed'
,
speed
).
html
(
link
))
@
setSpeed
(
@
currentSpeed
)
@
setSpeed
@
currentSpeed
reRender
:
(
newSpeeds
)
->
@
$
(
'.video_speeds'
).
empty
()
@
speeds
newSpeeds
console
.
log
"Changing speeds"
console
.
log
@
speeds
@
speeds
=
newSpeeds
$
.
each
@
speeds
,
(
index
,
speed
)
=>
link
=
$
(
'<a>'
).
attr
(
href
:
"#"
).
html
(
"
#{
speed
}
x"
)
@
$
(
'.video_speeds'
).
prepend
(
$
(
'<li>'
).
attr
(
'data-speed'
,
speed
).
html
(
link
))
...
...
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