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

209
Visualizações
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
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