mirror of
https://github.com/antebudimir/feishin.git
synced 2025-12-31 10:03:33 +00:00
adjust web playback error handler (#1150)
This commit is contained in:
parent
f4be797f16
commit
bca4a14f2e
1 changed files with 8 additions and 8 deletions
|
|
@ -233,17 +233,17 @@ export const AudioPlayer = forwardRef<AudioPlayerRef, AudioPlayerProps>((props,
|
|||
}
|
||||
|
||||
const { error } = target;
|
||||
if (error?.code !== MediaError.MEDIA_ERR_DECODE) {
|
||||
|
||||
console.log('Playback error occurred:', error);
|
||||
|
||||
if (
|
||||
error?.code !== MediaError.MEDIA_ERR_DECODE &&
|
||||
error?.code !== MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
const duration = player.getDuration();
|
||||
const currentTime = player.getCurrentTime();
|
||||
|
||||
// Decode error within last second, handle as track ended
|
||||
if (duration && duration - currentTime < 1) {
|
||||
handleOnEnded();
|
||||
}
|
||||
handleOnEnded();
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue