useAudioPlayer
useAudioPlayer copied to clipboard
WAV files do not load on iPad iOS 15.2
Describe the bug
My react code is able to play MP3s and Wavs on a desktop, but not on Mobile safari on iOS 15.2 (iPad Air 4th Gen). The WAV files do not play. Adding html5:true
to the howler config will fix things, however that seems like a patch and not a solution.
To Reproduce Code Example:
case 'playSound': {
const logSoundName = payload.data.url.split('/')
console.log(`🍎 attempting to play sound: ${logSoundName[logSoundName.length-1]} 🍎`);
const sound = new Howl({
src: [payload.data.url],
volume: 0.2,
onload: (soundId: number) => {
console.log(`🍎 onLoad - attempting to play sound# ${soundId} 🍎`);
sound.play();
},
onplay:(soundId: number) => {
console.log(`🍎 onPlay sound# ${soundId} 🍎`);
},
});
sound.once('loaderror', (e) => console.log(`load error: ${e}`))
sound.once('playerror', (e) => console.log(`playerror: ${e}`))
break;
}
Expected behavior
- Inspecting the Safari console (iPad simulator) I can see the following logs for playing a WAV (first log) and MP3 (final 3 logs). As you can see the logs are not firing for the sound loading, but also they are not firing for any error.
- The
playerror
orloaderror
callbacks never happen - The
play
callback is also never called. The sound is neither playing nor failing with error.
Environment (please complete the following information):
- Browser/ browser version: Safari iOS 15.2
- Library version: 2.2.0
- React version: 17.0.2
- Node version: 14