jlengstorf / twilio-gatsby-video-chat

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Make sure that camera and mic disconnect when clicking "leave room"

jlengstorf opened this issue · comments

Right now, clicking the "leave room" button takes you back to the lobby, but the mic and camera remain on.

I just started looking into this but it looks like we actually have two video tracks. One that Twilio grabs for us and one that we create. So, I'm thinking we don't need to create a localTrack per this issue twilio/video-quickstart-js#48 (comment). Instead, it looks like we can just attach the default track that Twilio creates for us..

For example, change localTrack to const localTrack =[...room.localParticipant.videoTracks.values()][0].track; I made those changes locally and the video seems to turn off just fine, though you would probably want to rename that variable. Haven't looked at audio yet, but I've run out of time today.

Thanks so much for digging into this, @boggsey! That was the problem. #2 implements the fix. Really appreciate your help with this!