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
Show 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
...
@@ -25,7 +25,7 @@ class @VideoAlpha
"1.0"
:
sub
"1.0"
:
sub
"1.25"
:
sub
"1.25"
:
sub
"1.5"
:
sub
"1.5"
:
sub
@
setSpeed
(
$
.
cookie
(
'video_speed'
)
)
@
setSpeed
$
.
cookie
(
'video_speed'
)
$
(
"#video_
#{
@
id
}
"
).
data
(
'video'
,
this
).
addClass
(
'video-load-complete'
)
$
(
"#video_
#{
@
id
}
"
).
data
(
'video'
,
this
).
addClass
(
'video-load-complete'
)
if
@
show_captions
is
true
if
@
show_captions
is
true
@
hide_captions
=
$
.
cookie
(
'hide_captions'
)
==
'true'
@
hide_captions
=
$
.
cookie
(
'hide_captions'
)
==
'true'
...
@@ -47,7 +47,7 @@ class @VideoAlpha
...
@@ -47,7 +47,7 @@ class @VideoAlpha
youtubeId
:
(
speed
)
->
youtubeId
:
(
speed
)
->
@
videos
[
speed
||
@
speed
]
@
videos
[
speed
||
@
speed
]
VideoAlpha
::
parseVideos
=
(
videos
)
->
parseVideos
:
(
videos
)
->
return
false
if
(
typeof
videos
isnt
"string"
)
or
(
videos
.
length
is
0
)
return
false
if
(
typeof
videos
isnt
"string"
)
or
(
videos
.
length
is
0
)
@
videos
=
{}
@
videos
=
{}
_this
=
this
_this
=
this
...
@@ -58,7 +58,7 @@ class @VideoAlpha
...
@@ -58,7 +58,7 @@ class @VideoAlpha
_this
.
videos
[
speed
]
=
video
[
1
]
_this
.
videos
[
speed
]
=
video
[
1
]
true
true
VideoAlpha
::
parseVideoSources
=
(
mp4Source
,
webmSource
,
oggSource
)
->
parseVideoSources
:
(
mp4Source
,
webmSource
,
oggSource
)
->
@
html5Sources
=
@
html5Sources
=
mp4
:
null
mp4
:
null
webm
:
null
webm
:
null
...
@@ -69,9 +69,9 @@ class @VideoAlpha
...
@@ -69,9 +69,9 @@ class @VideoAlpha
parseSpeed
:
->
parseSpeed
:
->
@
speeds
=
(
$
.
map
@
videos
,
(
url
,
speed
)
->
speed
).
sort
()
@
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
if
@
speeds
.
indexOf
(
newSpeed
)
isnt
-
1
@
speed
=
newSpeed
@
speed
=
newSpeed
$
.
cookie
"video_speed"
,
""
+
newSpeed
,
$
.
cookie
"video_speed"
,
""
+
newSpeed
,
...
@@ -91,7 +91,7 @@ class @VideoAlpha
...
@@ -91,7 +91,7 @@ class @VideoAlpha
getDuration
:
->
getDuration
:
->
@
metadata
[
@
youtubeId
()].
duration
@
metadata
[
@
youtubeId
()].
duration
VideoAlpha
::
log
=
(
eventName
)
->
log
:
(
eventName
)
->
logInfo
=
logInfo
=
id
:
@
id
id
:
@
id
code
:
@
youtubeId
()
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
...
@@ -94,19 +94,16 @@ class @VideoPlayerAlpha extends SubviewAlpha
when
@
PlayerState
.
UNSTARTED
when
@
PlayerState
.
UNSTARTED
if
@
video
.
videoType
is
"youtube"
if
@
video
.
videoType
is
"youtube"
availableSpeeds
=
@
player
.
getAvailablePlaybackRates
()
availableSpeeds
=
@
player
.
getAvailablePlaybackRates
()
console
.
log
@
video
.
videos
if
availableSpeeds
.
length
>
1
if
availableSpeeds
.
length
>
1
baseSpeedSubs
=
@
video
.
videos
[
"1.0"
]
baseSpeedSubs
=
@
video
.
videos
[
"1.0"
]
$
.
each
@
video
.
videos
,
(
index
,
value
)
->
$
.
each
@
video
.
videos
,
(
index
,
value
)
->
delete
_this
.
video
.
videos
[
index
]
delete
_this
.
video
.
videos
[
index
]
@
video
.
speeds
=
[]
$
.
each
availableSpeeds
,
(
index
,
value
)
->
$
.
each
availableSpeeds
,
(
index
,
value
)
->
_this
.
video
.
videos
[
value
.
toFixed
(
2
).
replace
(
/\.00$/
,
".0"
)]
=
baseSpeedSubs
_this
.
video
.
videos
[
value
.
toFixed
(
2
).
replace
(
/\.00$/
,
".0"
)]
=
baseSpeedSubs
_this
.
video
.
speeds
.
push
value
.
toFixed
(
2
).
replace
(
/\.00$/
,
".0"
)
@
speedControl
.
reRender
()
@
speedControl
.
reRender
@
video
.
speeds
@
video
.
videoType
=
'html5'
console
.
log
"UNSTARTED. available speeds = "
console
.
log
availableSpeeds
@
onUnstarted
()
@
onUnstarted
()
when
@
PlayerState
.
PLAYING
when
@
PlayerState
.
PLAYING
@
onPlay
()
@
onPlay
()
...
@@ -162,12 +159,12 @@ class @VideoPlayerAlpha extends SubviewAlpha
...
@@ -162,12 +159,12 @@ class @VideoPlayerAlpha extends SubviewAlpha
if
@
video
.
videoType
is
'youtube'
if
@
video
.
videoType
is
'youtube'
@
currentTime
=
Time
.
convert
(
@
currentTime
,
parseFloat
(
@
currentSpeed
()),
newSpeed
)
@
currentTime
=
Time
.
convert
(
@
currentTime
,
parseFloat
(
@
currentSpeed
()),
newSpeed
)
newSpeed
=
parseFloat
(
newSpeed
).
toFixed
(
2
).
replace
/\.00$/
,
'.0'
newSpeed
=
parseFloat
(
newSpeed
).
toFixed
(
2
).
replace
/\.00$/
,
'.0'
@
video
.
setSpeed
(
newSpeed
)
@
video
.
setSpeed
newSpeed
if
@
video
.
videoType
is
'youtube'
if
@
video
.
videoType
is
'youtube'
if
@
video
.
show_captions
is
true
if
@
video
.
show_captions
is
true
@
caption
.
currentSpeed
=
newSpeed
@
caption
.
currentSpeed
=
newSpeed
if
@
video
.
videoType
is
'html5'
if
@
video
.
videoType
is
'html5'
@
player
.
set
Speed
(
newSpeed
)
@
player
.
set
PlaybackRate
newSpeed
else
if
@
video
.
videoType
is
'youtube'
else
if
@
video
.
videoType
is
'youtube'
if
@
isPlaying
()
if
@
isPlaying
()
@
player
.
loadVideoById
(
@
video
.
youtubeId
(),
@
currentTime
)
@
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
...
@@ -24,20 +24,14 @@ class @VideoSpeedControlAlpha extends SubviewAlpha
<ol class="video_speeds"></ol>
<ol class="video_speeds"></ol>
</div>
</div>
"""
"""
$
.
each
@
speeds
,
(
index
,
speed
)
=>
$
.
each
@
speeds
,
(
index
,
speed
)
=>
link
=
$
(
'<a>'
).
attr
(
href
:
"#"
).
html
(
"
#{
speed
}
x"
)
link
=
$
(
'<a>'
).
attr
(
href
:
"#"
).
html
(
"
#{
speed
}
x"
)
@
$
(
'.video_speeds'
).
prepend
(
$
(
'<li>'
).
attr
(
'data-speed'
,
speed
).
html
(
link
))
@
$
(
'.video_speeds'
).
prepend
(
$
(
'<li>'
).
attr
(
'data-speed'
,
speed
).
html
(
link
))
@
setSpeed
(
@
currentSpeed
)
@
setSpeed
@
currentSpeed
reRender
:
(
newSpeeds
)
->
reRender
:
(
newSpeeds
)
->
@
$
(
'.video_speeds'
).
empty
()
@
$
(
'.video_speeds'
).
empty
()
@
speeds
=
newSpeeds
@
speeds
newSpeeds
console
.
log
"Changing speeds"
console
.
log
@
speeds
$
.
each
@
speeds
,
(
index
,
speed
)
=>
$
.
each
@
speeds
,
(
index
,
speed
)
=>
link
=
$
(
'<a>'
).
attr
(
href
:
"#"
).
html
(
"
#{
speed
}
x"
)
link
=
$
(
'<a>'
).
attr
(
href
:
"#"
).
html
(
"
#{
speed
}
x"
)
@
$
(
'.video_speeds'
).
prepend
(
$
(
'<li>'
).
attr
(
'data-speed'
,
speed
).
html
(
link
))
@
$
(
'.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