Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

143
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!