adjust web playback error handler (#1150)

This commit is contained in:
Jeff 2025-09-24 18:09:30 -07:00 committed by GitHub
parent f4be797f16
commit bca4a14f2e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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();
};
};