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
a845e5d9
Commit
a845e5d9
authored
Jun 01, 2012
by
Calen Pennington
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #78 from MITx/ps-fix-youtube-click
Trigger a pause event when user click Youtube logo
parents
98a8f9cb
ade3b2dd
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
1 deletions
+12
-1
static/coffee/spec/modules/video/video_player_spec.coffee
+8
-0
static/coffee/src/modules/video/video_player.coffee
+4
-1
No files found.
static/coffee/spec/modules/video/video_player_spec.coffee
View file @
a845e5d9
...
...
@@ -126,6 +126,14 @@ describe 'VideoPlayer', ->
it
'trigger pause event'
,
->
expect
(
'pause'
).
toHaveBeenTriggeredOn
@
player
describe
'when the video is unstarted'
,
->
beforeEach
->
spyOnEvent
@
player
,
'pause'
@
player
.
onStateChange
data
:
YT
.
PlayerState
.
UNSTARTED
it
'trigger pause event'
,
->
expect
(
'pause'
).
toHaveBeenTriggeredOn
@
player
describe
'when the video is ended'
,
->
beforeEach
->
spyOnEvent
@
player
,
'ended'
...
...
static/coffee/src/modules/video/video_player.coffee
View file @
a845e5d9
class
@
VideoPlayer
constructor
:
(
@
video
)
->
# Define a missing constant of Youtube API
YT
.
PlayerState
.
UNSTARTED
=
-
1
@
currentTime
=
0
@
element
=
$
(
"#video_
#{
@
video
.
id
}
"
)
@
render
()
...
...
@@ -57,7 +60,7 @@ class @VideoPlayer
switch
event
.
data
when
YT
.
PlayerState
.
PLAYING
$
(
@
).
trigger
(
'play'
)
when
YT
.
PlayerState
.
PAUSED
when
YT
.
PlayerState
.
PAUSED
,
YT
.
PlayerState
.
UNSTARTED
$
(
@
).
trigger
(
'pause'
)
when
YT
.
PlayerState
.
ENDED
$
(
@
).
trigger
(
'ended'
)
...
...
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