0

我正在寻找仅在 ApiRTC 中进行音频呼叫的方法,但随着流不断出现,我似乎无法做到这一点。希望有人可以提供帮助。提前致谢。下面是我的代码

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();


  }

4

1 回答 1

1

订阅流时,您可以将 SubscribeOptions 作为第二个参数传递: conversation.subscribeToStream(streamId, { audioOnly: true })

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

这将使订阅者只接收音频。

于 2021-06-24T12:28:47.590 回答