philnash / twilio-video-react-hooks

A video chat application built with Twilio Video and React Hooks
MIT License
110 stars 61 forks source link

Flip camera don't working correctlly #24

Closed jcvidela closed 4 years ago

jcvidela commented 4 years ago

According to the twilio documentation, to make a flip camera, you first have to stop the local track, then unpublish it and finally publish a new track, the remote participant can see that flip camera but not on my screen, it stays black carbon (1)

jcvidela commented 4 years ago

I really think the problem lies in the Room listeners(Room.js), when unsubscribing a track it works well (none can see or hear it) but when publishing a new one it is not updated, but I have not been able to decipher it.

philnash commented 4 years ago

@jcvidela thanks for reporting this, I'll have a go to see if I can implement camera switching and what I manage and will let you know.

philnash commented 4 years ago

@jcvidela I had a go at sorting this out. It turns out that the local participant doesn't fire "trackUnpublished" events or "trackUnsubscribed" events, which is what the Participant component was using to change videos.

So, I built a LocalParticipant component along with a CameraSelect component and integrated them on this branch: https://github.com/philnash/twilio-video-react-hooks/compare/changing-cameras

Take a look and see if that helps.

jcvidela commented 4 years ago

it's working perfect thanks