client-sdk-unity-web
client-sdk-unity-web copied to clipboard
hardware camera not releasing when disconnect and reconnect in another room
If you connect a room room.Connect(url, token) then you disconnect from room room.Disconect(true)
and so connect again in a different room with other token and roomName, the video track stack, and camera hardware never turn off.
publishing track {localTrack: LocalVideoTrack} publishing track {localTrack: LocalVideoTrack} publishing track {localTrack: LocalVideoTrack}
and no way to unpublish and release de camera. even doing a disconnection again, the track keep stacking
how to fully destroy a local Track? from c# before disconnect room, to prevent it keep stacking?
Client.CreateLocalVideoTrack(opts);
has no way to be destroyed
Hey, you should be able to unpublish a track using LocalParticipant.UnpublishTrack.
It remove from unity, not from JS. In my case, the user can change many times of Room, when user change a room, even the room destroyed, the JS object still having listeners and alive in the DOM. From the C# side, has no way to clear the JS object complete. If you use only one room is fine, use the LocalParticipant.UnpublishTrack, but in the next room you enter, it will be stacked in the HTML DOM.
Hey, sorry for the late answer. The DOM objects will not be directly deleted because of the C# GC. You can try to call Room.Dispose when you're done with it. You should still be able to turn off the hardware camera even if the DOM is still present. Removing the listeners from the Room object on destroy is tricky (can lead to Null references when an event is called in a certain timing). I will experiment with another way of dealing with listeners after releasing the native SDK :)