OiO.lk Blog javascript Audio Not Playing in Mobile Chrome at 100% Volume, but Works at 99%
javascript

Audio Not Playing in Mobile Chrome at 100% Volume, but Works at 99%


In mobile Chrome, I’m experiencing an issue where audio does not play through headphones when the volume is set to 100%. The sound is playing but is not outputting to the headphones. However, if I lower the volume by just 1%, the sound immediately becomes audible. When I set the volume back to 100%, the audio continues to play fine. What could be causing this behavior, and is there a way to ensure the sound is always outputted at 100% volume?

I use the following code:

startProcessingFromFile(position) {
    this.inputSource = this.audioContext.createBufferSource();
    this.inputSource.buffer = this._audioBuffer;

    // Connect the source directly to the output
    this.inputSource.connect(this.audioContext.destination);

    // Calculate the offset in the audio buffer corresponding to the video position
    let sampleRate = this._audioBuffer.sampleRate;
    let startOffset = position * sampleRate;

    // Set the starting position in the audio buffer
    this.inputSource.start(0, startOffset / sampleRate);
}

P.S. I acknowledge that this could be a bug specific only to my phone with a custom ROM and root access. I’m interested to know if this issue occurs for people with regular smartphones.



You need to sign in to view this answers

Exit mobile version