How to resume media stream after stopping this

24 Views Asked by At

I have stopped the media stream when turn off camera. I want that when I turn on camera stream should resume.

Camera off:

  this.stream1.getTracks().forEach((track) => track.stop());

I tried to resume the track/stream after turning on camera

               const newStream=  navigator.mediaDevices.getUserMedia({ video:true})

                this.stream1.getTracks().forEach((track) => {
                    newStream.addTrack(track.clone());
                });

                this.stream1 = newStream;
0

There are 0 best solutions below