4

I have used twilio-video:1.19.2 in angular 8.

I have implemented functionality of one-to-one video call.

Below is my code i use to enable/disable video.

toggleVideo() {
    this.videoConference.isPaused = !this.videoConference.isPaused;
    this.twilioRoom.localParticipant.videoTracks.forEach(track => {
        if (this.videoConference.isPaused) {
            track.disable();
        } else {
            track.enable();
        }
    });
}

Video call seems to work fine. But when i pause video on participant side only some time black screen is displayed. Most of time it freezes video (last recorded frame stays).

This issue is reported on react-twilio library https://github.com/blackuy/react-native-twilio-video-webrtc/issues/165

Does anyone know how to resolve this?

Is there any way to add black(video track) screen?

I want to show black screen when video is paused from participant side.

Ankur Akvaliya
  • 2,989
  • 4
  • 28
  • 53

2 Answers2

6

Twilio developer evangelist here.

What you need to do in this case is handle the remote user disabling their track and remove it from your local view.

To do this, you can listen for the Participant's trackDisabled event and handle it accordingly.

remoteParticipant.on('trackDisabled', track => {
  // hide or remove the media element related to this track
});

You should ensure to write code to handle the track being enabled again:

remoteParticipant.on('trackEnabled', track => {
  // show the track again
});
philnash
  • 70,667
  • 10
  • 60
  • 88
  • Is there a way to show black screen track? If i remove track then it looks like participant is disconnected. – Ankur Akvaliya Oct 25 '19 at 06:37
  • Of course there is, it's your angular app, you can render a `
    ` with a black background or your user's avatar, or a generic avatar image. It's entirely up to you.
    – philnash Oct 25 '19 at 06:44
  • Yes. It's that video is adding in some part of that div (track size is different). So wanted to show black screen of same size. with making main div black it will look different. – Ankur Akvaliya Oct 25 '19 at 08:12
  • I’m afraid I don’t know how your app is rendered or styled, but I would think with some experimentation you could figure out a way to replace the missing video. Relying on the video going black is really relying on an unintended side effect of losing a stream and replacing it with something that fits in your UI would be a better user experience. – philnash Oct 25 '19 at 08:17
0

How To Participant Audio Track Disable.

//Participant is all participant connect with Room. For Ex. User-1 Screen Page Participant User-2, User-3 And User-4.

participant.audioTracks.forEach(function (track) {
//sid is disable Audio track Particular Participant sid. For Ex. User-1 Screen Participant User-3 audio disable using audio track sid It is Possible. If Possible give me code or reference url link.
if (track.sid == sid) {
//participant audio track disable.
     track.disable();
}
else {
     //participant audio track enable.
     track.enabled();
}
});

Any Way Another Way Please Give Code Or Reference URL Link I Do This.

Dipen Modi
  • 11
  • 4