Commit e18e18a8 by Waheed Ahmed

Merge pull request #5055 from edx/waheed/bld1221-fix-video-not-play-in-firefox-on-speed-change

Fixed video not playing after changing speed to anything other than 1.
parents d147c7e5 0448c994
......@@ -496,7 +496,7 @@ function (VideoPlayer) {
state.speed = '2.0';
state.videoPlayer.onPlay();
expect(state.videoPlayer.setPlaybackRate)
.toHaveBeenCalledWith('2.0');
.toHaveBeenCalledWith('2.0', true);
state.videoPlayer.onPlay();
expect(state.videoPlayer.setPlaybackRate.calls.length)
.toEqual(1);
......
......@@ -96,7 +96,7 @@ function (HTML5Video, Resizer) {
$(window).on('unload', state.saveState);
if (!state.isFlashMode() && state.speed != '1.0') {
state.videoPlayer.setPlaybackRate(state.speed);
state.videoPlayer.setPlaybackRate(state.speed, true);
}
});
......@@ -351,18 +351,17 @@ function (HTML5Video, Resizer) {
}
}
function setPlaybackRate(newSpeed) {
function setPlaybackRate(newSpeed, useCueVideoById) {
var duration = this.videoPlayer.duration(),
time = this.videoPlayer.currentTime,
methodName, youtubeId;
// 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 &&
newSpeed === '1.0' &&
this.isYoutubeType()
)
this.isHtml5Mode() && !(this.browserIsFirefox &&
(useCueVideoById || newSpeed === '1.0') && this.isYoutubeType())
) {
this.videoPlayer.player.setPlaybackRate(newSpeed);
} else {
......@@ -385,7 +384,10 @@ function (HTML5Video, Resizer) {
// is in a PAUSED state.
//
// Why? This is how the YouTube API is implemented.
this.videoPlayer.updatePlayTime(time);
// 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(
......
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