I am trying to play some audio on the new Safari version(15), it plays the audio but does not trigger the audio.onended function.
useEffect(() => {
if (audio !== null) {
audio.onended = () => console.log('hello');
}
}, [audio]);
Here is a screenshot when I test in safari: https://gyazo.com/ebdc247bfd7195d9bcaa9bef7050b22c
Here is a screenshot when I tested in chrome: https://gyazo.com/813d37a405cd54a0b736330876498887
As you can see on chrome, it is working well and in safari it is not triggering the audio.onended
Do you have similar problem as me? If you have how can I fix this issue?