Commit a2dcf9aa by polesye

Merge pull request #689 from edx/anton/fix_video_speed_button

Video: disable speed controls for unsupported browsers.
parents 346fb7b4 9b76b492
......@@ -10,6 +10,12 @@ function () {
return function (state) {
state.videoSpeedControl = {};
if (state.videoType === 'html5' && !(_checkPlaybackRates())) {
_hideSpeedControl(state);
return;
}
_makeFunctionsPublic(state);
_renderElements(state);
_bindHandlers(state);
......@@ -62,6 +68,35 @@ function () {
}
/**
* @desc Check if playbackRate supports by browser.
*
* @type {function}
* @access private
*
* @param {object} state The object containg the state of the video player.
* All other modules, their parameters, public variables, etc. are
* available via this object.
*
* @this {object} The global window object.
*
* @returns {Boolean}
* true: Browser support playbackRate functionality.
* false: Browser doesn't support playbackRate functionality.
*/
function _checkPlaybackRates() {
var video = document.createElement('video');
// If browser supports, 1.0 should be returned by playbackRate property.
// In this case, function return True. Otherwise, False will be returned.
return Boolean(video.playbackRate);
}
// Hide speed control.
function _hideSpeedControl(state) {
state.el.find('div.speeds').hide();
}
/**
* @desc Bind any necessary function callbacks to DOM events (click,
* mousemove, etc.).
*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment