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

201
Views
webkitAudioContext on iOS (15.4.1) pitch fluctuations with MediaElementSource

I am making a website that plays mp3 audio and then fades out after X seconds. I had this working using a regular audio tag implementation by manipulating the volume at an interval, but this solution doesn't work on iOS because volume is a readonly property. I discovered that this could be achieved using the AudioContext api, but that I would need to use webkitAudioContext for Safari/iOS.

I have implemented a solution using context.createMediaElementSource but the audio pitch is all over the place. When the audio first starts playing it's pitched up for a few seconds, and also when you minimize the app and reopen it will pitch up again. I'm guessing it's something to do with the internal clock becoming misaligned so playback is being sped up to accommodate - but either way the app just isn't really usable with this problem.

I have found discussions about other distortion/buzzing issues surrounding this API on iOS but no mention of pitch issues. I found an answer submission here which links to a jsfiddle that exhibits the exact same audio pitch issues.

I have tried an implementation using createBufferSource instead of createMediaElementSource which actually resolves the issue, but managing the audio using that api (checking/setting the current position, checking/setting the pause/playing/stopped state e.t.c) seems impossible.

I've created a CodeSandbox demo and also uploaded a video to demonstrate and you can hear that the pitch shift is extremely obvious. Does anyone know how consistent this will reproduce across iOS devices (I imagine, very consistent) and can anyone suggest a fix/workaround?

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!