DEV Community

Discussion on: Build an in browser video chat with screen sharing using Twilio Video

shaijut profile image
Shaiju T • Edited on

Nice 😄, Is there a code to just share the screen without any chat features. Suppose I have my web cam on using getUserMedia , and I want to share my web cam to another folk using a link , Possible ?

philnash profile image
Phil Nash Author

Do you mean just share the camera and not the microphone?

If so, then yes. You can do so by only requesting or passing a camera stream to the Video.connect function. For example:

Video.connect(token, { audio: false, video: true });

You could just share a screen too, but you would have to get the screen with getDisplayMedia and then pass the track to Video.connect. Something like:

getDisplayMedia().then(stream => {
  const track = stream.tracks[0];
  Video.connect(token, { tracks [track] });