Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

149
Visualizações
Html audio player volume not changing on mobile

I built a custom HTML audio player and I'm having another error with it on mobile

You can view it here https://dolbydev.wpengine.com/audio-player/

For some reason when I try to adjust the volume with the volume range slider the volume doesn't change. This problem is only on mobile

I thought it might have something to do with the event listeners that I'm using but I don't think that's the issue As you see in my code you'll notice that I load the proper event when detecting mobile which in this case is touchend

I also console logged the values and they are changing when moving the volume slider and testing on iOS safari

I'm at a loss as to what the issue is on mobile. Anybody have any ideas of why that might be

    const volumeSlider = audioPlayerBlockContainer.getElementsByClassName('audioplayer_volume_slider')[0];
    const isDevice = /ipad|iphone|ipod|android/i.test(window.navigator.userAgent.toLowerCase()) && !window.MSStream;
    const volumeSliderEvent = (isDevice ? 'touchend' : 'input') 

    const audio1 = new Audio(audioFileSwitchOff);
    const audio2 = new Audio(audioFileSwitchOn);

    volumeSlider.addEventListener(volumeSliderEvent, (e) => {
        const value = e.target.value;

        audio1.volume = value / 100
        audio2.volume = value / 100

        console.log(volumeSliderEvent)
        console.log(`Audio 1: ${audio1.volume}`)
        console.log(`Audio 2: ${audio2.volume}`)
    })
about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda