Mute video stream from ApiRTC in Ionic 5

182 views Asked by At

I am looking for ways to do Audio call only in ApiRTC but cannot seem to do it right as the streams keep on appearing. Hoping someone could assist. Thanks in advance. Below is my code

startVoiceCall() {
      //apiRTC.setLogLevel(10);

      this.ua = new apiRTC.UserAgent({
          uri: "apzkey:xxxx",
      });

      let registerInformation = {
          cloudUrl: "https://cloud.apizee.com",
      };

        this.ua
            .register(registerInformation)
            .then((session) => {
                this.isDisabled = false;
                console.log("User registered with session: ", session);


                session
                    .on("contactListUpdate", (updatedContacts) => {
                        console.log("contactListUpdate", updatedContacts);
                    })
                    .on("incomingCall", (invitation) => {
                              var answerOptions = {
                                  mediaTypeForIncomingCall : 'AUDIO'
                                };
                        invitation.accept(null, answerOptions).then((call) => {
                            this.currentCall = call;
                            this.setAudioCallListeners();
                            this.onCall = true;
                        });
                    });
                    //session.allowMultipleCalls(true);

                this.connectedSession = session;

             
            });

        this.checkPermissions();


  }

1

There are 1 answers

0
Kevin-Apizee On

When subscribing to a stream, you can pass SubscribeOptions as second parameter with : conversation.subscribeToStream(streamId, { audioOnly: true })

ApiRTC reference : https://dev.apirtc.com/reference/Conversation.html#subscribeToStream

This will make the subscriber receive audio only.