[bugfix]: web player edge cases

Two bugs addressed in response to Safari changes:
1. Only handle `onEnded` for real streams, preventing `autoNext()` spam when the last track finishes
2. `.play()` is not necessarily a safe operation (if empty wave was started, can cause exception later). Catch this exception and discard it. This also only occurred when playing the last track
This commit is contained in:
Kendall Garner
2024-01-28 01:50:51 -08:00
parent 47ce0ed47b
commit 5cc2276781
3 changed files with 26 additions and 7 deletions
@@ -138,7 +138,10 @@ export const useCenterControls = (args: { playersRef: any }) => {
mpvPlayer?.volume(usePlayerStore.getState().volume);
mpvPlayer!.play();
} else {
currentPlayerRef.getInternalPlayer().play();
currentPlayerRef
.getInternalPlayer()
?.play()
.catch(() => {});
}
play();