Merge pull request #2358 from Szczork/szczork/log-speed-change-video

add condition - log speed change / loading video
This commit is contained in:
Valera Rozuvan
2014-02-05 12:46:25 +02:00
2 changed files with 21 additions and 8 deletions

View File

@@ -196,6 +196,17 @@
});
});
it('speed_change_video event is not logged when speed not change', function () {
expect(state.videoPlayer.log).not.toHaveBeenCalledWith(
'speed_change_video',
{
current_time: state.videoPlayer.currentTime,
old_speed: state.speed,
new_speed: state.speed
}
);
});
it('log the play_video event', function () {
expect(state.videoPlayer.log).toHaveBeenCalledWith(
'play_video', { currentTime: 0 }

View File

@@ -338,14 +338,16 @@ function (HTML5Video, Resizer) {
newSpeed = parseFloat(newSpeed).toFixed(2).replace(/\.00$/, '.0');
this.videoPlayer.log(
'speed_change_video',
{
current_time: time,
old_speed: this.speed,
new_speed: newSpeed
}
);
if (this.speed != newSpeed) {
this.videoPlayer.log(
'speed_change_video',
{
current_time: time,
old_speed: this.speed,
new_speed: newSpeed
}
);
}
this.setSpeed(newSpeed, true);