How to implement individual options (like video and audio) of twilio in php

50 views Asked by At

I am going to integrate twilio api in my project.

Here I want to give some options like listen only to audio instead of watching the video. How can I implement this option, i.e. how can I make the video to be invisible?

Any suggestion? Thank you.

1

There are 1 answers

0
philnash On

Twilio developer evangelist here.

When a participant joins a room the easiest way to show both their Video and Audio is to use attach() to slot them into the DOM as a <video> element.

However, if you want independent control of the audio and video then you probably want to inspect and attach the participant's media.audioTracks and media.videoTracks separately. Each property is a map of a Track.ID and an AudioTrack or VideoTrack. You can then attach and detach the individual tracks as you like over the course of the call.

Let me know if that helps at all.