Open krunkster opened 4 years ago
I forgot to highlight the fact that the volume on the sound effect channel does change as expected. So I can work around this issue by changing all of the "Music" calls to "Sound" calls. The two sets of methods seem to have parity in functionality... but it's still a bug. It feels like I should be using music calls for playing music, and sound calls to play sound effects... but I'm not really sure what the difference is... so not sure if I should just work around this issue or wait for bug fix.
I looked through the code, and it seems to me that Gdevelop is using the Howler library, and your use of that library is making a distinction between Sound and Music, but the only difference at the library level is whether "html5 audio" is enabled (which it is for Music and not for Sound methods).
So I researched that a bit and it appears that volume for "HTML5 Audio" on iOS is dictated strictly to user control. Using WebAudio the volume can be manipulated using software.
WebAudio loads the entire file into memory, and HTML5 Audio streams the file from the server.
There is a newer WebAudio API called AudioBufferSourceNode that may allow streaming like HTML5 audio, but it's not clear whether Howler is adopting that already or how to leverage it.
Work Around If your use of music (like mine) is from fairly small mp3s, just switch to using GDevelop's Sound methods (instead of Music) to ensure iOS compatibility.
Some helpful articles I found: https://stackoverflow.com/questions/27296391/is-there-any-possibility-to-control-html5-audio-volume-on-ios https://github.com/goldfire/howler.js/issues/415#issuecomment-487263098
Thanks for the in-depth analysis! I believe you're right and this is a limitation that we have to document somewhere. I think something in the wiki would be good: http://wiki.compilgames.net/doku.php/gdevelop5/all-features/audio
If your use of music (like mine) is from fairly small mp3s, just switch to using GDevelop's Sound methods (instead of Music) to ensure iOS compatibility.
Sounds like a good workaround indeed.
Description
Using the "Play Music on Channel" with a specific volume, or calling "Change music volume on channel" has no effect when running on iOS browsers. This bug occurs on both Safari and Chrome iOS versions, as well as native mode when built using Cordova. It is easiest to reproduce using a network preview and loading on safari iOS.
To Reproduce
I've attached a reproduction. ios-music-volume-bug.zip
Other details