diff --git a/common/lib/xmodule/xmodule/js/spec/video/video_player_spec.js b/common/lib/xmodule/xmodule/js/spec/video/video_player_spec.js index 51b1bd5287..628ff5e7a6 100644 --- a/common/lib/xmodule/xmodule/js/spec/video/video_player_spec.js +++ b/common/lib/xmodule/xmodule/js/spec/video/video_player_spec.js @@ -183,6 +183,25 @@ function (VideoPlayer) { }); }); + describe('onReady YouTube', function () { + beforeEach(function () { + state = jasmine.initializePlayerYouTube(); + + state.videoEl = $('video, iframe'); + }); + + it('multiple speeds and flash mode, change back to html5 mode', function () { + var playbackRates = state.videoPlayer.player.getAvailablePlaybackRates(); + + state.currentPlayerMode = 'flash'; + + state.videoPlayer.onReady(); + + expect(playbackRates.length).toBe(4); + expect(state.currentPlayerMode).toBe('html5'); + }); + }); + describe('onStateChange', function () { describe('when the video is unstarted', function () { beforeEach(function () { diff --git a/common/lib/xmodule/xmodule/js/src/video/03_video_player.js b/common/lib/xmodule/xmodule/js/src/video/03_video_player.js index 0a5acd87da..bab774649e 100644 --- a/common/lib/xmodule/xmodule/js/src/video/03_video_player.js +++ b/common/lib/xmodule/xmodule/js/src/video/03_video_player.js @@ -559,7 +559,7 @@ function (HTML5Video, Resizer) { ); if ( - this.currentPlayerMode === 'html5' && + (this.currentPlayerMode === 'html5' || availablePlaybackRates.length > 1) && this.videoType === 'youtube' ) { if (availablePlaybackRates.length === 1 && !this.isTouch) { @@ -573,6 +573,8 @@ function (HTML5Video, Resizer) { _restartUsingFlash(this); } else if (availablePlaybackRates.length > 1) { + this.currentPlayerMode = 'html5'; + // We need to synchronize available frame rates with the ones // that the user specified.