clone localMedia,so we don't remove audio track from stream sent to peer

This commit is contained in:
Bruno Windels 2023-01-20 17:33:16 +01:00
parent 6645f8f43b
commit 590e9500c1

View File

@ -43,7 +43,7 @@ export class LocalMedia {
* Create an instance of LocalMedia without audio track (for user preview)
*/
asPreview(): LocalMedia {
const media = new LocalMedia(this.userMedia, this.screenShare, this.dataChannelOptions);
const media = this.clone();
const userMedia = media.userMedia;
if (userMedia && userMedia.getVideoTracks().length > 0) {
const audioTrack = getStreamAudioTrack(userMedia);