AgoraIO-Community/Agora-RTC-React

Closing tracks doesn't turn off camera light

diego-hernandez-mejia opened this issue · 2 comments

I'm testing the sample code you gave but when I leave call and close trackers my camera light still on and brwosers show the icon in tab that says the website is using microphone or camera.

I've also tried first stopping them and then closing each one but it doesn't work.

React 18 - node 16.15.1

const leaveChannel = async () => {
        await client.leave();
        client.removeAllListeners();
        // we close the tracks to perform cleanup
        await tracks[0].stop();
        await tracks[0].close();        
        await tracks[1].stop();
        await tracks[1].close();
        // the camera light should go off
        setStart(false);
        setInCall(false);
        // you can now unmount the component if required
    };

@diego-hernandez-mejia How did you resolve the issue?

@sunweiyang I disabled React Strict Mode on development mode cause it rendered video twice and only closed one