From 8e5a63c4406d56f127fb8a41d81e9485b738ab31 Mon Sep 17 00:00:00 2001 From: Awais Jibran Date: Fri, 24 Apr 2015 10:40:45 +0500 Subject: [PATCH] Videos should emit `stop_video` event once the video segment is compelte. TNL-2008 --- .../xmodule/js/src/video/03_video_player.js | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/common/lib/xmodule/xmodule/js/src/video/03_video_player.js b/common/lib/xmodule/xmodule/js/src/video/03_video_player.js index 12b40c123c..a4c268cfa7 100644 --- a/common/lib/xmodule/xmodule/js/src/video/03_video_player.js +++ b/common/lib/xmodule/xmodule/js/src/video/03_video_player.js @@ -49,7 +49,8 @@ function (HTML5Video, Resizer) { update: update, figureOutStartEndTime: figureOutStartEndTime, figureOutStartingTime: figureOutStartingTime, - updatePlayTime: updatePlayTime + updatePlayTime: updatePlayTime, + logStopVideo:logStopVideo }; VideoPlayer.prototype = methodsDict; @@ -348,6 +349,8 @@ function (HTML5Video, Resizer) { this.trigger('videoProgressSlider.notifyThroughHandleEnd', { end: true }); + // Emit `stop_video` event + this.videoPlayer.logStopVideo(); } } } @@ -531,12 +534,7 @@ function (HTML5Video, Resizer) { function onEnded() { var time = this.videoPlayer.duration(); - this.videoPlayer.log( - 'stop_video', - { - currentTime: this.videoPlayer.currentTime - } - ); + this.videoPlayer.logStopVideo(); this.trigger('videoControl.pause', null); this.trigger('videoProgressSlider.notifyThroughHandleEnd', { @@ -593,6 +591,15 @@ function (HTML5Video, Resizer) { this.videoPlayer.player.setPlaybackQuality(value); } + function logStopVideo(){ + this.videoPlayer.log( + 'stop_video', + { + currentTime: this.videoPlayer.currentTime + } + ); + } + function onPlaybackQualityChange() { var quality;