为什么解码AudioData在iOS上不起作用?

时间:2018-10-22 18:08:05

标签: javascript ios node.js reactjs

Recorder.js库在iOS上运行良好,但是当我添加以下功能以增强声音效果时,录音机将无法正常工作。如何解决以下问题?

async function loadTransform(e, transformName, ...transformArgs) {
    
        let outputSection = document.getElementById("output");
        outputSection.style.display = "flex";
        document.getElementById("body").style.overflow = "hidden";
    
        if(!globalAudioBuffer) {
            let ctx = new AudioContext();
            globalAudioBuffer = await ctx.decodeAudioData(arrayBuffer);
        } 
        
        let outputAudioBuffer = await window[transformName+"Transform"](globalAudioBuffer, ...transformArgs);
        let outputWavBlob = await audioBufferToWaveBlob(outputAudioBuffer);
        let audioUrl = window.URL.createObjectURL(outputWavBlob); 
        let audioTag = document.getElementById("audioTag");
        audioTag.src = audioUrl;
        audioTag.play();
        audioTag.addEventListener('click', audioTag.play());
        blob = outputWavBlob;
    
    }

0 个答案:

没有答案