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
1956020f
Commit
1956020f
authored
Jun 05, 2013
by
Valera Rozuvan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Overhaul of event log of load, play, pause, seek, speed-change events.
parent
48edd4a2
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
28 additions
and
34 deletions
+28
-34
common/lib/xmodule/xmodule/js/src/videoalpha/display.coffee
+8
-25
common/lib/xmodule/xmodule/js/src/videoalpha/display/video_caption.coffee
+1
-1
common/lib/xmodule/xmodule/js/src/videoalpha/display/video_player.coffee
+17
-3
common/lib/xmodule/xmodule/js/src/videoalpha/display/video_progress_slider.coffee
+2
-5
No files found.
common/lib/xmodule/xmodule/js/src/videoalpha/display.coffee
View file @
1956020f
...
...
@@ -83,19 +83,6 @@ class @VideoAlpha
embed
:
->
@
player
=
new
VideoPlayerAlpha
video
:
this
@
attachEventDispatchToFunctions
onPlay
:
'play_video'
onPause
:
'pause_video'
attachEventDispatchToFunctions
:
(
funcList
)
->
$
.
each
funcList
,
(
funcName
,
eventName
)
=>
@
player
[
funcName
]
=
@
attachEventDispatch
(
@
player
[
funcName
],
eventName
)
if
@
player
.
hasOwnProperty
(
funcName
)
attachEventDispatch
:
(
func
,
eventName
)
->
=>
@
log
eventName
func
.
apply
this
,
arguments
fetchMetadata
:
(
url
)
->
@
metadata
=
{}
$
.
each
@
videos
,
(
speed
,
url
)
=>
...
...
@@ -104,21 +91,17 @@ class @VideoAlpha
getDuration
:
->
@
metadata
[
@
youtubeId
()].
duration
log
:
(
eventName
)
->
console
.
log
'log'
console
.
log
'this = '
,
this
console
.
log
id
:
@
id
code
:
@
youtubeId
()
currentTime
:
@
player
.
currentTime
speed
:
@
speed
console
.
log
''
log
:
(
eventName
,
data
)
->
# Default parameters that always get logged.
logInfo
=
id
:
@
id
code
:
@
youtubeId
()
currentTime
:
@
player
.
currentTime
speed
:
@
speed
# If extra parameters were passed to the log.
if
data
$
.
each
data
,
(
paramName
,
value
)
->
logInfo
[
paramName
]
=
value
if
@
videoType
is
"youtube"
logInfo
.
code
=
@
youtubeId
()
else
logInfo
.
code
=
"html5"
if
@
videoType
is
"html5"
...
...
common/lib/xmodule/xmodule/js/src/videoalpha/display/video_caption.coffee
View file @
1956020f
...
...
@@ -120,7 +120,7 @@ class @VideoCaptionAlpha extends SubviewAlpha
seekPlayer
:
(
event
)
=>
event
.
preventDefault
()
time
=
Math
.
round
(
Time
.
convert
(
$
(
event
.
target
).
data
(
'start'
),
'1.0'
,
@
currentSpeed
)
/
1000
)
$
(
@
).
trigger
(
'seek'
,
time
)
$
(
@
).
trigger
(
'
caption_
seek'
,
time
)
calculateOffset
:
(
element
)
->
@
captionHeight
()
/
2
-
element
.
height
()
/
2
...
...
common/lib/xmodule/xmodule/js/src/videoalpha/display/video_player.coffee
View file @
1956020f
...
...
@@ -24,9 +24,9 @@ class @VideoPlayerAlpha extends SubviewAlpha
if
@
video
.
videoType
is
'youtube'
$
(
@
qualityControl
).
bind
(
'changeQuality'
,
@
handlePlaybackQualityChange
)
if
@
video
.
show_captions
is
true
$
(
@
caption
).
bind
(
'seek'
,
@
onSeek
)
$
(
@
caption
).
bind
(
'
caption_
seek'
,
@
onSeek
)
$
(
@
speedControl
).
bind
(
'speedChange'
,
@
onSpeedChange
)
$
(
@
progressSlider
).
bind
(
'seek'
,
@
onSeek
)
$
(
@
progressSlider
).
bind
(
's
lide_s
eek'
,
@
onSeek
)
if
@
volumeControl
$
(
@
volumeControl
).
bind
(
'volumeChange'
,
@
onVolumeChange
)
$
(
document
).
keyup
@
bindExitFullScreen
...
...
@@ -96,6 +96,7 @@ class @VideoPlayerAlpha extends SubviewAlpha
at
:
'top center'
onReady
:
(
event
)
=>
@
video
.
log
'load_video'
if
@
video
.
videoType
is
'html5'
@
player
.
setPlaybackRate
@
video
.
speed
unless
onTouchBasedDevice
()
...
...
@@ -184,6 +185,8 @@ class @VideoPlayerAlpha extends SubviewAlpha
@
caption
.
pause
()
onPlay
:
=>
@
video
.
log
'play_video'
,
currentTime
:
@
currentTime
unless
@
player
.
interval
@
player
.
interval
=
setInterval
(
@
update
,
200
)
if
@
video
.
show_captions
is
true
...
...
@@ -192,6 +195,8 @@ class @VideoPlayerAlpha extends SubviewAlpha
@
progressSlider
.
play
()
onPause
:
=>
@
video
.
log
'pause_video'
,
currentTime
:
@
currentTime
clearInterval
(
@
player
.
interval
)
@
player
.
interval
=
null
if
@
video
.
show_captions
is
true
...
...
@@ -204,7 +209,10 @@ class @VideoPlayerAlpha extends SubviewAlpha
@
caption
.
pause
()
onSeek
:
(
event
,
time
)
=>
console
.
log
'old time = '
+
@
currentTime
+
', new time = '
+
time
@
video
.
log
'seek_video'
,
old_time
:
@
currentTime
new_time
:
time
type
:
event
.
type
@
player
.
seekTo
(
time
,
true
)
if
@
isPlaying
()
clearInterval
(
@
player
.
interval
)
...
...
@@ -217,6 +225,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
.
log
'speed_change_video'
,
currentTime
:
@
currentTime
old_speed
:
@
currentSpeed
()
new_speed
:
newSpeed
@
video
.
setSpeed
newSpeed
,
updateCookie
if
@
video
.
videoType
is
'youtube'
if
@
video
.
show_captions
is
true
...
...
common/lib/xmodule/xmodule/js/src/videoalpha/display/video_progress_slider.coffee
View file @
1956020f
...
...
@@ -7,10 +7,7 @@ class @VideoProgressSliderAlpha extends SubviewAlpha
range
:
'min'
change
:
@
onChange
# We don't want to attach to 'slide' event because we already have 'change' event.
# If we have two events, then callback will be triggered twice, sending misinformation
# to the server.
# slide: @onSlide
slide
:
@
onSlide
stop
:
@
onStop
@
buildHandle
()
...
...
@@ -39,7 +36,7 @@ class @VideoProgressSliderAlpha extends SubviewAlpha
onSlide
:
(
event
,
ui
)
=>
@
frozen
=
true
@
updateTooltip
(
ui
.
value
)
$
(
@
).
trigger
(
'seek'
,
ui
.
value
)
$
(
@
).
trigger
(
's
lide_s
eek'
,
ui
.
value
)
onChange
:
(
event
,
ui
)
=>
@
updateTooltip
(
ui
.
value
)
...
...
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