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 this.safePlay(activeElement)
|
||||||
void playPromise.catch((error) => retryImmediateHandoff(error).catch(console.error));
|
.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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1546,10 +1554,20 @@ export class Player {
|
||||||
const newTracks = await this.fetchMoreArtistPopularTracks();
|
const newTracks = await this.fetchMoreArtistPopularTracks();
|
||||||
if (newTracks && newTracks.length > 0) {
|
if (newTracks && newTracks.length > 0) {
|
||||||
await this.addToQueue(newTracks);
|
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) {
|
} else if (this.repeatMode === REPEAT_MODE.ALL) {
|
||||||
this.currentQueueIndex = 0;
|
this.currentQueueIndex = 0;
|
||||||
const track = currentQueue[this.currentQueueIndex];
|
const track = currentQueue[this.currentQueueIndex];
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue