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

475
Visualizações
Audio not playing on IOS: [native code]:1 Unhandled Promise Rejection: NotSupportedError: The operation is not supported

Operating System: Windows to Apple iOS
Device: PC to iPhone 6, iPhone XS, iPhone XR, iPhone 11, iPhone 6S
Browser: Safari, Google Chrome
Errors: [native code]:1 Unhandled Promise Rejection: NotSupportedError: The operation is not supported.
[native code]:1 Unhandled Promise Rejection: NotAllowedError: The request is not allowed by the user agent or the platform in the current context, possibly because the user denied permission.

Code:

let started = false;
let audio = new Audio();
audio.src = "data:audio/mpeg;base64,SUQzBAAAAAABEVRYWFgAAAAtAAADY29tbWVudABCaWdTb3VuZEJhbmsuY29tIC8gTGFTb25vdGhlcXVlLm9yZwBURU5DAAAAHQAAA1N3aXRjaCBQbHVzIMKpIE5DSCBTb2Z0d2FyZQBUSVQyAAAABgAAAzIyMzUAVFNTRQAAAA8AAANMYXZmNTcuODMuMTAwAAAAAAAAAAAAAAD/80DEAAAAA0gAAAAATEFNRTMuMTAwVVVVVVVVVVVVVUxBTUUzLjEwMFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVf/zQsRbAAADSAAAAABVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVf/zQMSkAAADSAAAAABVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV";

...

class FrequencyData {
    constructor() {
        this.audioContext = null;
        this.source = null;
        this.analyser = null;
    }

    getFrequencies() {
        if (!this.audioContext) {
            this.audioContext = new window.AudioContext();
            this.source = this.audioContext.createMediaElementSource(audio);
            this.analyser = this.audioContext.createAnalyser();
        }

        this.source.connect(this.analyser);
        this.analyser.connect(this.audioContext.destination);

        return [new Uint8Array(this.analyser.frequencyBinCount), this.analyser];
    }
}

let frequencyData = new FrequencyData();

window.addEventListener("touchstart", function() { // Allows for audio to be played without needing user interaction every time.
    if (!started) {
        audio.play();
        started = true;
    }
});

...

webSocket.onmessage = function(event) {
        let message = event.data;
        audio.src = "";

        ...

        audio.src = "data:audio/mp3;base64," + message;
        audio.play();
        render();

        ...


The errors occur at the same time. I tested them on my iPhone and on hosted iPhones on browserstack so I could view the developer console. The audio is being sent through a websocket being hosted on my PC and is sent to the client which are the phones. It worked while testing it on other PCs. The audio is being sent as a base64 string and are mp3 files.

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