mediacapture-extensions icon indicating copy to clipboard operation
mediacapture-extensions copied to clipboard

Update MediaStream and/or MediaStreamTrack objects when input device changes?

Open yuhonglin opened this issue 2 years ago • 0 comments

Hi all,

I am relatively new to the media capture API. Recently I found after obtaining the MediaStream object, even if the input device changed, the metadata of the already-obtained MediaStream object is not updated. For example, if I do the following,

  1. In a website, use getUserMedia to obtain a stream object with "audio=true".
  2. Insert an external microphone.
  3. The system will then automatically capture audio from the external microphone. But if the metadata of the stream object doesn't change, although it is already capturing audio from the external microphone.

It seems the only way to observe this is to listen to the "MediaDevices.ondevicechange" event. And it seems video conferencing websites will recall the getUserMedia when this happens. Then they can obtain a new stream with correct metadata.

Is this an intended behaviour?

yuhonglin avatar Jun 29 '22 06:06 yuhonglin