Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
edx-platform-release
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Hsin-Yu Chien
edx-platform-release
Commits
fee8f6db
Commit
fee8f6db
authored
9 years ago
by
Awais Jibran
Browse files
Options
Downloads
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
Loading
Loading
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
common/lib/xmodule/xmodule/js/spec/video/video_player_spec.js
+23
-0
23 additions, 0 deletions
...on/lib/xmodule/xmodule/js/spec/video/video_player_spec.js
common/lib/xmodule/xmodule/js/src/video/03_video_player.js
+5
-0
5 additions, 0 deletions
common/lib/xmodule/xmodule/js/src/video/03_video_player.js
with
28 additions
and
0 deletions
common/lib/xmodule/xmodule/js/spec/video/video_player_spec.js
+
23
−
0
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
()
{
...
...
This diff is collapsed.
Click to expand it.
common/lib/xmodule/xmodule/js/src/video/03_video_player.js
+
5
−
0
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
);
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment