+ 7

Audio-volume in JS

Hi, I tried to lower the volume of my audio, and for some reason it works on PC but not on phones. Anyone got any idea why? I used this: myAudio.volume = 0.5 Even when setting volume to 0 it still plays on my phone. Thanks in advance, Joakim https://code.sololearn.com/W1XJn0X6XTHU/?ref=app

31st May 2018, 7:28 PM
Joakim Nyland
Joakim Nyland - avatar
1 Odpowiedź
+ 9
Assuming Chromium webview: possibly a bug, not waiting for the element to actually start playing (simply telling it to play does not mean the object has updated; you may have to release the main thread [by falling off the end of your function] so events fire, then update the volume), etc. This thread discusses a few related things + how to possibly avoid the 100% volume blip that may occur if you can't set the volume early enough: https://bugs.chromium.org/p/chromium/issues/detail?id=33023
2nd Jun 2018, 4:58 PM
Kirk Schafer
Kirk Schafer - avatar