Commit 97ec1cec by Nishant Karandikar Committed by muzaffaryousaf

Remove unnecessary javascript

Previously, the Youtube API had a bug where a speed change from
another speed back to 1.0 would not register properly in Firefox.
The API has since been fixed, so there is no need for a workaround
parent 89518d79
......@@ -383,71 +383,9 @@ function(HTML5Video, Resizer) {
function setPlaybackRate(newSpeed, useCueVideoById) {
var duration = this.videoPlayer.duration(),
time = this.videoPlayer.currentTime,
methodName, youtubeId;
// There is a bug which prevents YouTube API to correctly set the speed
// to 1.0 from another speed in Firefox when in HTML5 mode. There is a
// fix which basically reloads the video at speed 1.0 when this change
// is requested (instead of simply requesting a speed change to 1.0).
// This has to be done only when the video is being watched in Firefox.
// We need to figure out what browser is currently executing this code.
//
// TODO: Check the status of
// http://code.google.com/p/gdata-issues/issues/detail?id=4654
// When the YouTube team fixes the API bug, we can remove this
// temporary bug fix.
// If useCueVideoById is true it will reload video again.
// Used useCueVideoById to fix the issue video not playing if we change
// the speed before playing the video.
if (
this.isHtml5Mode() && !(this.browserIsFirefox &&
(useCueVideoById || newSpeed === '1.0') && this.isYoutubeType())
) {
this.videoPlayer.player.setPlaybackRate(newSpeed);
} else {
// We request the reloading of the video in the case when YouTube
// is in Flash player mode, or when we are in Firefox, and the new
// speed is 1.0. The second case is necessary to avoid the bug
// where in Firefox speed switching to 1.0 in HTML5 player mode is
// handled incorrectly by YouTube API.
methodName = 'cueVideoById';
youtubeId = this.youtubeId(newSpeed);
if (this.videoPlayer.isPlaying()) {
methodName = 'loadVideoById';
}
time = this.videoPlayer.currentTime;
this.videoPlayer.player[methodName](youtubeId, time);
// We need to call play() explicitly because after the call
// to functions cueVideoById() followed by seekTo() the video
// is in a PAUSED state.
//
// Why? This is how the YouTube API is implemented.
// sjson.search() only works if time is defined.
if (!_.isUndefined(time)) {
this.videoPlayer.updatePlayTime(time);
}
if (time > 0 && this.isFlashMode()) {
this.videoPlayer.seekTo(time);
this.trigger(
'videoProgressSlider.updateStartEndTimeRegion',
{
duration: duration
}
);
}
// In Html5 mode if video speed is changed before playing in firefox and
// changed speed is not '1.0' then manually trigger setPlaybackRate method.
// In browsers other than firefox like safari user can set speed to '1.0'
// if its not already set to '1.0' so in that case we don't have to
// call 'setPlaybackRate'
if (this.isHtml5Mode() && newSpeed != '1.0') {
this.videoPlayer.player.setPlaybackRate(newSpeed);
}
}
this.videoPlayer.player.setPlaybackRate(newSpeed);
}
function onSpeedChange(newSpeed) {
......
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