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
fee8f6db
Commit
fee8f6db
authored
Jun 09, 2015
by
Awais Jibran
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #8037 from edx/aj/tnl2167-pause-vide-event-not-emitting-at-video-end
pause_video event does not emit when a video ends
parents
9a55497e
8956b403
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
0 deletions
+28
-0
common/lib/xmodule/xmodule/js/spec/video/video_player_spec.js
+23
-0
common/lib/xmodule/xmodule/js/src/video/03_video_player.js
+5
-0
No files found.
common/lib/xmodule/xmodule/js/spec/video/video_player_spec.js
View file @
fee8f6db
...
...
@@ -196,6 +196,29 @@ function (VideoPlayer) {
});
});
describe
(
'onStateChange Youtube'
,
function
(){
describe
(
'when the video is ended'
,
function
()
{
beforeEach
(
function
()
{
state
=
jasmine
.
initializePlayerYouTube
();
state
.
videoEl
=
$
(
'video, iframe'
);
spyOn
(
$
.
fn
,
'trigger'
).
andCallThrough
();
state
.
videoPlayer
.
onStateChange
({
data
:
YT
.
PlayerState
.
ENDED
});
});
it
(
'pause the video control'
,
function
()
{
expect
(
$
(
'.video_control'
)).
toHaveClass
(
'play'
);
});
it
(
'trigger pause and ended events'
,
function
()
{
expect
(
$
.
fn
.
trigger
).
toHaveBeenCalledWith
(
'pause'
,
{});
expect
(
$
.
fn
.
trigger
).
toHaveBeenCalledWith
(
'ended'
,
{});
});
});
});
describe
(
'onStateChange'
,
function
()
{
describe
(
'when the video is unstarted'
,
function
()
{
beforeEach
(
function
()
{
...
...
common/lib/xmodule/xmodule/js/src/video/03_video_player.js
View file @
fee8f6db
...
...
@@ -553,6 +553,11 @@ function (HTML5Video, Resizer) {
// `duration`. In this case, slider doesn't reach the end point of
// timeline.
this
.
videoPlayer
.
updatePlayTime
(
time
);
// Emit 'pause_video' event when a video ends if Player is of Youtube
if
(
this
.
isYoutubeType
())
{
this
.
el
.
trigger
(
'pause'
,
arguments
);
}
this
.
el
.
trigger
(
'ended'
,
arguments
);
}
...
...
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