"play_video" event emitted after seeking forward in a video contains old position
This commit is contained in:
Awais Jibran
2015-06-10 20:26:15 +05:00
parent 9f0b5ed2cd
commit 989091d1ed
2 changed files with 26 additions and 2 deletions

View File

@@ -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 () {
beforeEach(function () {
state = jasmine.initializePlayer();

View File

@@ -493,8 +493,6 @@ function (HTML5Video, Resizer) {
if (this.videoPlayer.isPlaying()) {
this.videoPlayer.stopTimer();
} else {
this.videoPlayer.currentTime = time;
}
var isUnplayed = this.videoPlayer.isUnstarted() ||
this.videoPlayer.isCued();
@@ -521,6 +519,8 @@ function (HTML5Video, Resizer) {
if (this.videoPlayer.isPlaying()) {
this.videoPlayer.runTimer();
}
// Update the the current time when user seek. (YoutubePlayer)
this.videoPlayer.currentTime = time;
}
function runTimer() {