Merge pull request #2571 from Szczork/szczork/log-video-ended

log stop_video event
This commit is contained in:
Anton Stupak
2014-06-25 17:57:15 +03:00
2 changed files with 16 additions and 0 deletions

View File

@@ -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
}
);
});
});
});

View File

@@ -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', {