Fixed video not playing after changing speed to anything other than 1.
BLD-1221
This commit is contained in:
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user