mirror of
https://github.com/antebudimir/feishin.git
synced 2026-01-01 10:23: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;
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const duration = player.getDuration();
|
handleOnEnded();
|
||||||
const currentTime = player.getCurrentTime();
|
|
||||||
|
|
||||||
// Decode error within last second, handle as track ended
|
|
||||||
if (duration && duration - currentTime < 1) {
|
|
||||||
handleOnEnded();
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue