blueberrymuffin3 / osu-js

https://osu-js.pages.dev
MIT License
2 stars 1 forks source link

iOS Safari throws error 4 on audio loading #54

Closed kionell closed 2 years ago

kionell commented 2 years ago

Jeez, this browser is so dumb... I can't even find where this error is happening, because it just throws 4 as a number... Through trial and error, I figured out that it's something related to Howler's onloaderror event. I have no idea how to fix this.

image

blueberrymuffin3 commented 2 years ago

I think the 4 may actually be the sound ID. The error handler is currently mistaking it for the error message. Unfortunately, I don't have access to an iphone to test on atm, so I can't reproduce.

blueberrymuffin3 commented 2 years ago

Nevermind, it seems like that is the actual error code. I make the error less cryptic in f677ada0a067eefea9cb0be1619934bda8c2e23f.

kionell commented 2 years ago

Disabling HTML5 audio for iOS devices fixes this problem. I need to ask my friend to test it on his iPhone.

loaded.audio = await loadSound({
  src: (await blobUrlFromFile(audioFile)) as string,
  html5: !isUsingIOS,
  preload: !isUsingIOS ? "metadata" : true,
  format: audioFile.name.substring(
    audioFile.name.lastIndexOf(".") + 1
  ),
});
kionell commented 2 years ago

@blueberrymuffin3 Audio now loads correctly on iOS.