Skip to content

Commit

Permalink
fix(UI): Video starts playing automatically when selecting a playback…
Browse files Browse the repository at this point in the history
… rate (#7786)

Fixes #7756
  • Loading branch information
avelad authored Dec 20, 2024
1 parent 51765e9 commit ac568a4
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
6 changes: 0 additions & 6 deletions lib/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -4664,12 +4664,6 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
}
this.trickPlayEventManager_.removeAll();

if (this.video_.paused) {
// Our fast forward is implemented with playbackRate and needs the video
// to be playing (to not be paused) to take immediate effect.
// If the video is paused, "unpause" it.
this.video_.play();
}
this.playRateController_.set(rate);

if (this.loadMode_ == shaka.Player.LoadMode.MEDIA_SOURCE) {
Expand Down
7 changes: 7 additions & 0 deletions ui/fast_forward_button.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,13 @@ shaka.ui.FastForwardButton = class extends shaka.ui.Element {
// selected. If no more rates are available, the first one is set.
const newRate = (newRateIndex != this.fastForwardRates_.length) ?
this.fastForwardRates_[newRateIndex] : this.fastForwardRates_[0];

if (this.video.paused) {
// Our fast forward is implemented with playbackRate and needs the video
// to be playing (to not be paused) to take immediate effect.
// If the video is paused, "unpause" it.
this.video.play();
}
this.player.trickPlay(newRate);

this.button_.setAttribute('shaka-status', newRate + 'x');
Expand Down
7 changes: 7 additions & 0 deletions ui/rewind_button.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,13 @@ shaka.ui.RewindButton = class extends shaka.ui.Element {
// selected. If no more rates are available, the first one is set.
const newRate = (newRateIndex != this.rewindRates_.length) ?
this.rewindRates_[newRateIndex] : this.rewindRates_[0];

if (this.video.paused) {
// Our fast forward is implemented with playbackRate and needs the video
// to be playing (to not be paused) to take immediate effect.
// If the video is paused, "unpause" it.
this.video.play();
}
this.player.trickPlay(newRate);

this.button_.setAttribute('shaka-status', newRate + 'x');
Expand Down

0 comments on commit ac568a4

Please sign in to comment.