When retrieving audio data from a stream, I encounter an issue with playing audio on iPhone Safari. The sound does not play unless I allow mediaDevice access for audio. Is there a way to play the audio without having to grant this permission?
This is the code snippet I am currently using:
var audioContext = window.AudioContext || window.webkitAudioContext;
var audioCtx = new audioContext();
var data = await audioCtx.decodeAudioData(result.audioData)
var source = new AudioBufferSourceNode(audioCtx);
source.buffer = data;
source.connect(audioCtx.destination);
source.start(0);
However, it seems that I have to explicitly allow media access:
await navigator.mediaDevices.getUserMedia({ audio: true })