AgoraIO-Community / Agora-RTC-React

A react wrapper for Agora RTC NG SDK
MIT License
92 stars 48 forks source link

Closing tracks doesn't turn off camera light #38

Closed diego-hernandez-mejia closed 1 year ago

diego-hernandez-mejia commented 2 years ago

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
    };
sunweiyang commented 1 year ago

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

diego-hernandez-mejia commented 1 year ago

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