This is a question on execution.
on video chat creation. Each user gets a div created for them which is just a black picture and their name.
when they click the start video button in my ui a localVideoTrack is created and published to all subscribers. The code then appends that video track to the UI
But what about when I want a audio only track? But I don't want any video?
What or I want audio and video but then want to mute the audio?
My thought is this.
you create a new local video track and either enable audio or video or both. When you want to change the state of a video track. Like turn off audio, you just create a local track again without audio publish it remove the current video track from the ui and replace it with the new one.
Or I could just use video and audio tracks but I don't know if that is the right move.
input would be appreciate!
Twilio developer evangelist here.
Video tracks and audio tracks are different. Video is only concerned with the camera and visual of a participant. Audio is only concerned with the microphone and the sound of a participant. So when you create a new video track, it should only ask for access to the camera and only publish a single video track. When you create a new audio track, it should only ask for access to a microphone and only publish a single audio track. When you create local tracks, or connect to a room and try to publish both audio and video, then permission is asked for both camera and microphone access, and two tracks, one for video and one for audio, are published.
At any stage after your participant connects to a Twilio Video room you can then publish new video/audio tracks to add new tracks to the participant. You can also unpublish those tracks, to completely remove them from the participant.
Once a track is published, you can then disable/enable the track, which is muting the audio/video without unpublishing it from the room. This is a quicker process than publishing/unpublishing.