Skip to content

Commit

Permalink
Fix video playing after seek with first pause #279
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrews54757 committed Oct 31, 2024
1 parent 71061ca commit d92da07
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions chrome/player/FastStreamClient.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ export class FastStreamClient extends EventEmitter {
fullscreen: false,
miniplayer: false,
windowedFullscreen: false,
autoPlayTriggered: false,
};

this._needsUserInteraction = false;
Expand Down Expand Up @@ -662,8 +663,11 @@ export class FastStreamClient extends EventEmitter {

this.interfaceController.updateToolVisibility();

this.state.autoPlayTriggered = false;
if (autoPlay) {
this.play();
this.play().then(() => {
this.state.autoPlayTriggered = true;
});
}

this.loadProgressData().then(async () => {
Expand All @@ -689,8 +693,10 @@ export class FastStreamClient extends EventEmitter {

this.disableProgressSave = false;

if (autoPlay) {
this.play();
if (autoPlay && !this.state.autoPlayTriggered) {
this.play().then(() => {
this.state.autoPlayTriggered = true;
});
}
});
} catch (e) {
Expand Down Expand Up @@ -1081,12 +1087,11 @@ export class FastStreamClient extends EventEmitter {

});

let autoPlayTriggered = false;
this.context.on(DefaultPlayerEvents.CANPLAY, (event) => {
this.player.playbackRate = this.state.playbackRate;

if (!autoPlayTriggered && this.options.autoPlay && this.state.playing === false) {
autoPlayTriggered = true;
if (!this.state.autoPlayTriggered && this.options.autoPlay && this.state.playing === false) {
this.state.autoPlayTriggered = true;
this.play();
}
});
Expand Down

0 comments on commit d92da07

Please sign in to comment.