diff --git a/common/lib/xmodule/xmodule/js/spec/video/video_player_spec.js b/common/lib/xmodule/xmodule/js/spec/video/video_player_spec.js index 90c0004abd..785f0d9183 100644 --- a/common/lib/xmodule/xmodule/js/spec/video/video_player_spec.js +++ b/common/lib/xmodule/xmodule/js/spec/video/video_player_spec.js @@ -335,6 +335,7 @@ function (VideoPlayer) { state.videoEl = $('video, iframe'); + spyOn(state.videoPlayer, 'log').andCallThrough(); spyOn(state.videoControl, 'pause').andCallThrough(); spyOn($.fn, 'trigger').andCallThrough(); @@ -350,6 +351,15 @@ function (VideoPlayer) { it('pause the video caption', function () { expect($.fn.trigger).toHaveBeenCalledWith('ended', {}); }); + + it('log stop_video event', function () { + expect(state.videoPlayer.log).toHaveBeenCalledWith( + 'stop_video', + { + currentTime: state.videoPlayer.currentTime + } + ); + }); }); }); 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 a3f7a5774c..ef3d7fcd60 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 @@ -506,6 +506,12 @@ function (HTML5Video, Resizer) { function onEnded() { var time = this.videoPlayer.duration(); + this.videoPlayer.log( + 'stop_video', + { + currentTime: this.videoPlayer.currentTime + } + ); this.trigger('videoControl.pause', null); this.trigger('videoProgressSlider.notifyThroughHandleEnd', {