Fixed two paly_video events emitted on video replay.

TNL-2166
This commit is contained in:
Waheed Ahmed
2015-06-09 16:16:47 +05:00
parent 698f6fb2d3
commit fb2f4fdade
2 changed files with 6 additions and 8 deletions

View File

@@ -51,14 +51,14 @@
});
});
it('callback was called', function () {
it('callback was not called', function () {
waitsFor(function () {
return state.videoPlayer.player.getPlayerState() !== STATUS.PAUSED;
}, 'Player state should be changed', WAIT_TIMEOUT);
runs(function () {
expect(state.videoPlayer.player.callStateChangeCallback)
.toHaveBeenCalled();
.not.toHaveBeenCalled();
});
});
});
@@ -85,14 +85,14 @@
});
});
it('callback was called', function () {
it('callback was not called', function () {
waitsFor(function () {
return state.videoPlayer.player.getPlayerState() !== STATUS.PLAYING;
}, 'Player state should be changed', WAIT_TIMEOUT);
runs(function () {
expect(state.videoPlayer.player.callStateChangeCallback)
.toHaveBeenCalled();
.not.toHaveBeenCalled();
});
});
});

View File

@@ -290,13 +290,11 @@ function () {
var PlayerState = HTML5Video.PlayerState;
if (_this.playerState === PlayerState.PLAYING) {
_this.pauseVideo();
_this.playerState = PlayerState.PAUSED;
_this.callStateChangeCallback();
_this.pauseVideo();
} else {
_this.playVideo();
_this.playerState = PlayerState.PLAYING;
_this.callStateChangeCallback();
_this.playVideo();
}
});