I created a video calling system. But when I disconnect the call the camera should off. I used MediaStreamTrack.stop()
to stop all tracks but it's not working.
Code to stop the stream:-
const tracks = stream.getTracks();
tracks.forEach((track) => {
track.stop();
});
stream.load();
remoteStream.current.srcObject = null;
localSteam.current.srcObject = null;