I want to get several audio MediaStreams from different mics, but getting new stream breaks previous. To reproduce this we need machine with 2 microphones connected. Steps: 1) get stream from first microphone (str1) 2) attach this stream to some audio node (or put to peer connection) 3) get another stream from second microphone (str2) actual result: observe that str1 now starts playing audio from second microphone some code example to try this //******************************// //get all available microphones let devices = await navigator.mediaDevices.enumerateDevices(); let microphones = devices.filter(d => d.kind === 'audioinput'); //get audio from first microphone let str1 = await navigator.mediaDevices.getUserMedia({audio: {deviceId: microphones[0].deviceId}}); //play first stream let audio = new Audio(); audio.srcObject = str1; audio.play(); //get audio from second microphone let str2 = await navigator.mediaDevices.getUserMedia({audio: {deviceId: microphones[1].deviceId}}); //observe that audio now starts playing audio from second microphone (not from str1) //******************************//
<rdar://problem/88433154>
Can you clarify which platform/application is the target for this request? Is it MacOS? iOS? Safari?
(In reply to youenn fablet from comment #2) > Can you clarify which platform/application is the target for this request? > Is it MacOS? iOS? Safari? The issue was updated (problem was observed on macOS 12, 11 on Safari 15)
Created attachment 463876 [details] Example to reproduce this problem Issue is still reproducible I tested on MacBook Pro 16 (2019) MacOS 13.1 Beta (22C5059b) Safari Version 16.2 (18614.3.7.1.3) I created small example. - press GET FIRST - make sure you can hear audio from first microphone - select another microphone in second select - press GET_SECOND after getting second microphone - first is lost you can open console and see that stream1 is not active and audio track has readyState === 'ended' this is in 90% tries..but sometimes first track is still active but audio source is wrong (audio plays from second microphone) In our application there is a case when we have 2 different audio from different microphones which we send via webrtc to remote participants. But because of this issue it doesnt work in safari.