P粉5369091862023-08-31 10:10:19
To turn everything off, the following method seems to work. I just found this through trial and error because I couldn't figure out how to get Safari to tell me what it still holds:
// stream : MediaStream // sourceNode : MediaStreamAudioSourceNode // recorderNode : AudioWorkletNode const tracks = stream.getTracks(); tracks.forEach((track) => { track.stop(); stream.removeTrack(track) }); stream = null sourceNode.disconnect(); sourceNode = undefined recorderNode.disconnect(); recorderNode = undefined