fix review comments on playback handoff
This commit is contained in:
parent
60b41a9635
commit
bd68c92a90
1 changed files with 24 additions and 6 deletions
30
js/player.js
30
js/player.js
|
|
@ -795,10 +795,18 @@ export class Player {
|
|||
}
|
||||
}
|
||||
|
||||
const playPromise = this.safePlay(activeElement);
|
||||
void playPromise.catch((error) => retryImmediateHandoff(error).catch(console.error));
|
||||
void this.safePlay(activeElement)
|
||||
.then((played) => {
|
||||
if (!played) {
|
||||
return retryImmediateHandoff(new Error('Immediate handoff did not start playback')).catch(
|
||||
console.error
|
||||
);
|
||||
}
|
||||
|
||||
this.preloadNextTracks();
|
||||
})
|
||||
.catch((error) => retryImmediateHandoff(error).catch(console.error));
|
||||
|
||||
this.preloadNextTracks();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -1546,10 +1554,20 @@ export class Player {
|
|||
const newTracks = await this.fetchMoreArtistPopularTracks();
|
||||
if (newTracks && newTracks.length > 0) {
|
||||
await this.addToQueue(newTracks);
|
||||
this.currentQueueIndex++;
|
||||
await this.playTrackFromQueue(0, recursiveCount, false, options);
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.repeatMode === REPEAT_MODE.ALL) {
|
||||
this.currentQueueIndex = 0;
|
||||
const track = currentQueue[this.currentQueueIndex];
|
||||
if (track?.isUnavailable || contentBlockingSettings.shouldHideTrack(track)) {
|
||||
return this.playNext(recursiveCount + 1, options);
|
||||
}
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
this.currentQueueIndex++;
|
||||
await this.playTrackFromQueue(0, recursiveCount, false, options);
|
||||
return;
|
||||
} else if (this.repeatMode === REPEAT_MODE.ALL) {
|
||||
this.currentQueueIndex = 0;
|
||||
const track = currentQueue[this.currentQueueIndex];
|
||||
|
|
|
|||
Loading…
Reference in a new issue