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
48edd4a2
Commit
48edd4a2
authored
Jun 04, 2013
by
Valera Rozuvan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Experimenting with optimal event attachment strategy.
parent
a3a7d1d5
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
3 deletions
+28
-3
common/lib/xmodule/xmodule/js/src/videoalpha/display.coffee
+22
-0
common/lib/xmodule/xmodule/js/src/videoalpha/display/video_player.coffee
+1
-2
common/lib/xmodule/xmodule/js/src/videoalpha/display/video_progress_slider.coffee
+5
-1
No files found.
common/lib/xmodule/xmodule/js/src/videoalpha/display.coffee
View file @
48edd4a2
...
@@ -83,6 +83,19 @@ class @VideoAlpha
...
@@ -83,6 +83,19 @@ class @VideoAlpha
embed
:
->
embed
:
->
@
player
=
new
VideoPlayerAlpha
video
:
this
@
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
)
->
fetchMetadata
:
(
url
)
->
@
metadata
=
{}
@
metadata
=
{}
$
.
each
@
videos
,
(
speed
,
url
)
=>
$
.
each
@
videos
,
(
speed
,
url
)
=>
...
@@ -92,6 +105,15 @@ class @VideoAlpha
...
@@ -92,6 +105,15 @@ class @VideoAlpha
@
metadata
[
@
youtubeId
()].
duration
@
metadata
[
@
youtubeId
()].
duration
log
:
(
eventName
)
->
log
:
(
eventName
)
->
console
.
log
'log'
console
.
log
'this = '
,
this
console
.
log
id
:
@
id
code
:
@
youtubeId
()
currentTime
:
@
player
.
currentTime
speed
:
@
speed
console
.
log
''
logInfo
=
logInfo
=
id
:
@
id
id
:
@
id
code
:
@
youtubeId
()
code
:
@
youtubeId
()
...
...
common/lib/xmodule/xmodule/js/src/videoalpha/display/video_player.coffee
View file @
48edd4a2
...
@@ -184,7 +184,6 @@ class @VideoPlayerAlpha extends SubviewAlpha
...
@@ -184,7 +184,6 @@ class @VideoPlayerAlpha extends SubviewAlpha
@
caption
.
pause
()
@
caption
.
pause
()
onPlay
:
=>
onPlay
:
=>
@
video
.
log
'play_video'
unless
@
player
.
interval
unless
@
player
.
interval
@
player
.
interval
=
setInterval
(
@
update
,
200
)
@
player
.
interval
=
setInterval
(
@
update
,
200
)
if
@
video
.
show_captions
is
true
if
@
video
.
show_captions
is
true
...
@@ -193,7 +192,6 @@ class @VideoPlayerAlpha extends SubviewAlpha
...
@@ -193,7 +192,6 @@ class @VideoPlayerAlpha extends SubviewAlpha
@
progressSlider
.
play
()
@
progressSlider
.
play
()
onPause
:
=>
onPause
:
=>
@
video
.
log
'pause_video'
clearInterval
(
@
player
.
interval
)
clearInterval
(
@
player
.
interval
)
@
player
.
interval
=
null
@
player
.
interval
=
null
if
@
video
.
show_captions
is
true
if
@
video
.
show_captions
is
true
...
@@ -206,6 +204,7 @@ class @VideoPlayerAlpha extends SubviewAlpha
...
@@ -206,6 +204,7 @@ class @VideoPlayerAlpha extends SubviewAlpha
@
caption
.
pause
()
@
caption
.
pause
()
onSeek
:
(
event
,
time
)
=>
onSeek
:
(
event
,
time
)
=>
console
.
log
'old time = '
+
@
currentTime
+
', new time = '
+
time
@
player
.
seekTo
(
time
,
true
)
@
player
.
seekTo
(
time
,
true
)
if
@
isPlaying
()
if
@
isPlaying
()
clearInterval
(
@
player
.
interval
)
clearInterval
(
@
player
.
interval
)
...
...
common/lib/xmodule/xmodule/js/src/videoalpha/display/video_progress_slider.coffee
View file @
48edd4a2
...
@@ -6,7 +6,11 @@ class @VideoProgressSliderAlpha extends SubviewAlpha
...
@@ -6,7 +6,11 @@ class @VideoProgressSliderAlpha extends SubviewAlpha
@
slider
=
@
el
.
slider
@
slider
=
@
el
.
slider
range
:
'min'
range
:
'min'
change
:
@
onChange
change
:
@
onChange
slide
:
@
onSlide
# 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
stop
:
@
onStop
stop
:
@
onStop
@
buildHandle
()
@
buildHandle
()
...
...
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