-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Force video player in flash mode. #3195
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -63,13 +63,16 @@ function (VideoPlayer, VideoStorage) { | |
fetchMetadata: fetchMetadata, | ||
getCurrentLanguage: getCurrentLanguage, | ||
getDuration: getDuration, | ||
getPlayerMode: getPlayerMode, | ||
getVideoMetadata: getVideoMetadata, | ||
initialize: initialize, | ||
isHtml5Mode: isHtml5Mode, | ||
isFlashMode: isFlashMode, | ||
parseSpeed: parseSpeed, | ||
parseVideoSources: parseVideoSources, | ||
parseYoutubeStreams: parseYoutubeStreams, | ||
saveState: saveState, | ||
setPlayerMode: setPlayerMode, | ||
setSpeed: setSpeed, | ||
trigger: trigger, | ||
youtubeId: youtubeId | ||
|
@@ -250,18 +253,6 @@ function (VideoPlayer, VideoStorage) { | |
} | ||
} | ||
|
||
// function _setPlayerMode(state) | ||
// By default we will be forcing HTML5 player mode. Only in the case | ||
// when, after initializtion, we will get one available playback rate, | ||
// we will change to Flash player mode. There is a need to store this | ||
// setting in cookies because otherwise we will have to change from | ||
// HTML5 to Flash on every page load in a browser that doesn't fully | ||
// support HTML5. When we have this setting in cookies, we can select | ||
// the proper mode from the start (not having to change mode later on). | ||
function _setPlayerMode(state) { | ||
state.currentPlayerMode = 'html5'; | ||
} | ||
|
||
// function _parseYouTubeIDs(state) | ||
// The function parse YouTube stream ID's. | ||
// @return | ||
|
@@ -339,8 +330,7 @@ function (VideoPlayer, VideoStorage) { | |
|
||
function _setConfigurations(state) { | ||
_configureCaptions(state); | ||
_setPlayerMode(state); | ||
|
||
state.setPlayerMode(state.config.mode); | ||
// Possible value are: 'visible', 'hiding', and 'invisible'. | ||
state.controlState = 'visible'; | ||
state.controlHideTimeout = null; | ||
|
@@ -520,7 +510,8 @@ function (VideoPlayer, VideoStorage) { | |
element: element, | ||
fadeOutTimeout: 1400, | ||
captionsFreezeTime: 10000, | ||
availableQualities: ['hd720', 'hd1080', 'highres'] | ||
availableQualities: ['hd720', 'hd1080', 'highres'], | ||
mode: $.cookie('edX_video_player_mode') | ||
}); | ||
|
||
if (this.config.endTime < this.config.startTime) { | ||
|
@@ -811,8 +802,46 @@ function (VideoPlayer, VideoStorage) { | |
} | ||
} | ||
|
||
/** | ||
* Sets player mode. | ||
* | ||
* @param {string} mode Mode to set for the video player if it is supported. | ||
* Otherwise, `html5` is used by default. | ||
*/ | ||
function setPlayerMode(mode) { | ||
var supportedModes = ['html5', 'flash']; | ||
|
||
mode = _.contains(supportedModes, mode) ? mode : 'html5'; | ||
this.currentPlayerMode = mode; | ||
} | ||
|
||
/** | ||
* Returns current player mode. | ||
* | ||
* @return {string} Returns string that describes player mode | ||
*/ | ||
function getPlayerMode() { | ||
return this.currentPlayerMode; | ||
} | ||
|
||
/** | ||
* Checks if current player mode is Flash. | ||
* | ||
* @return {boolean} Returns `true` if current mode is `flash`, otherwise | ||
* it returns `false` | ||
*/ | ||
function isFlashMode() { | ||
return this.currentPlayerMode === 'flash'; | ||
return this.getPlayerMode() === 'flash'; | ||
} | ||
|
||
/** | ||
* Checks if current player mode is Html5. | ||
* | ||
* @return {boolean} Returns `true` if current mode is `html5`, otherwise | ||
* it returns `false` | ||
*/ | ||
function isHtml5Mode() { | ||
return this.getPlayerMode() === 'html5'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why not isMode(mode_name)? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. By using current helpers you shouldn't remember possible values for the player mode. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Makes sense. |
||
} | ||
|
||
function getCurrentLanguage() { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cookie is defined only in acc.tests. What will be not in tests? mode will be undefined?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it will be
null
andsetPlayerMode
method will be called with this value. See line 814.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, thanks for the clarification.