Commit 989091d1 by Awais Jibran

TNL-2165

"play_video" event emitted after seeking forward in a video contains old position
parent 9f0b5ed2
...@@ -333,6 +333,30 @@ function (VideoPlayer) { ...@@ -333,6 +333,30 @@ function (VideoPlayer) {
}); });
}); });
describe('onSeek Youtube', function(){
beforeEach(function () {
state = jasmine.initializePlayerYouTube();
state.videoEl = $('video, iframe');
});
describe('when the video is playing', function () {
beforeEach(function(){
state.videoPlayer.onStateChange({
data: YT.PlayerState.PLAYING
});
});
it('Video has started playing', function () {
expect($('.video_control')).toHaveClass('pause');
});
it('seek the player', function () {
state.videoPlayer.seekTo(10);
expect(state.videoPlayer.currentTime).toBe(10);
});
});
});
describe('onSeek', function () { describe('onSeek', function () {
beforeEach(function () { beforeEach(function () {
state = jasmine.initializePlayer(); state = jasmine.initializePlayer();
......
...@@ -493,8 +493,6 @@ function (HTML5Video, Resizer) { ...@@ -493,8 +493,6 @@ function (HTML5Video, Resizer) {
if (this.videoPlayer.isPlaying()) { if (this.videoPlayer.isPlaying()) {
this.videoPlayer.stopTimer(); this.videoPlayer.stopTimer();
} else {
this.videoPlayer.currentTime = time;
} }
var isUnplayed = this.videoPlayer.isUnstarted() || var isUnplayed = this.videoPlayer.isUnstarted() ||
this.videoPlayer.isCued(); this.videoPlayer.isCued();
...@@ -521,6 +519,8 @@ function (HTML5Video, Resizer) { ...@@ -521,6 +519,8 @@ function (HTML5Video, Resizer) {
if (this.videoPlayer.isPlaying()) { if (this.videoPlayer.isPlaying()) {
this.videoPlayer.runTimer(); this.videoPlayer.runTimer();
} }
// Update the the current time when user seek. (YoutubePlayer)
this.videoPlayer.currentTime = time;
} }
function runTimer() { function runTimer() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment