From fb2f4fdade1286ff812668f47c4fe0606ba120d3 Mon Sep 17 00:00:00 2001 From: Waheed Ahmed Date: Tue, 9 Jun 2015 16:16:47 +0500 Subject: [PATCH] Fixed two paly_video events emitted on video replay. TNL-2166 --- .../lib/xmodule/xmodule/js/spec/video/html5_video_spec.js | 8 ++++---- common/lib/xmodule/xmodule/js/src/video/02_html5_video.js | 6 ++---- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/common/lib/xmodule/xmodule/js/spec/video/html5_video_spec.js b/common/lib/xmodule/xmodule/js/spec/video/html5_video_spec.js index b22cdd375e..2f9126cd8c 100644 --- a/common/lib/xmodule/xmodule/js/spec/video/html5_video_spec.js +++ b/common/lib/xmodule/xmodule/js/spec/video/html5_video_spec.js @@ -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(); }); }); }); diff --git a/common/lib/xmodule/xmodule/js/src/video/02_html5_video.js b/common/lib/xmodule/xmodule/js/src/video/02_html5_video.js index dc3fd7974b..dca85c9d85 100644 --- a/common/lib/xmodule/xmodule/js/src/video/02_html5_video.js +++ b/common/lib/xmodule/xmodule/js/src/video/02_html5_video.js @@ -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(); } });