From cf47f522c0c8063624bd20aff9df09c1055a3b4b Mon Sep 17 00:00:00 2001
From: Valera Rozuvan <valera@edx.org>
Date: Thu, 6 Mar 2014 18:36:33 +0200
Subject: [PATCH] Fix Firefox YouTube default Flash mode

BLD-895
---
 common/lib/xmodule/xmodule/js/spec/video/video_player_spec.js | 19 +++++++++++++++++++
 common/lib/xmodule/xmodule/js/src/video/03_video_player.js    |  4 +++-
 2 files changed, 22 insertions(+), 1 deletion(-)

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 51b1bd5..628ff5e 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 0a5acd8..bab7746 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.
 
--
libgit2 0.26.0