mirror of
https://github.com/antebudimir/feishin.git
synced 2025-12-31 10:03:33 +00:00
[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:
parent
47ce0ed47b
commit
5cc2276781
3 changed files with 26 additions and 7 deletions
|
|
@ -23,7 +23,10 @@ export const gaplessHandler = (args: {
|
|||
|
||||
const durationPadding = isFlac ? 0.065 : 0.116;
|
||||
if (currentTime + durationPadding >= duration) {
|
||||
return nextPlayerRef.current.getInternalPlayer()?.play();
|
||||
return nextPlayerRef.current
|
||||
.getInternalPlayer()
|
||||
?.play()
|
||||
.catch(() => {});
|
||||
}
|
||||
|
||||
return null;
|
||||
|
|
@ -61,7 +64,10 @@ export const crossfadeHandler = (args: {
|
|||
|
||||
if (shouldBeginTransition) {
|
||||
setIsTransitioning(true);
|
||||
return nextPlayerRef.current.getInternalPlayer().play();
|
||||
return nextPlayerRef.current
|
||||
.getInternalPlayer()
|
||||
?.play()
|
||||
.catch(() => {});
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue