为什么 agora.io 视频通话蒸汽在星云主题中不起作用?

Why agora.io video call steam not working in the Nebular theme?

提问人:Sanju Hashintha 提问时间:11/16/2023 更新时间:11/16/2023 访问量:17

问:

在我的应用程序中,有一个视频通话流。它没有星云主题,工作得很好。但是使用星云主题,它不会连接到视频通话 Steam。可能引起什么? 这是我正在努力的。

startCall() {
    console.log("start calllll");

    this.agoraService.client?.join('this.token',
      'this.channel', null, (uid: any) => {
        this.localStream = this.agoraService.createStream(uid, true, '', '', true, false);
        this.localStream.setVideoProfile('720p_3');
        this.subscribeToStreams();
      });
  }

  private subscribeToStreams() {
    this.localStream.on("accessAllowed", () => {
      console.log("AGOra-SDK--- accessAllowed");
    });
    // The user has denied access to the camera and mic.
    this.localStream.on("accessDenied", () => {
      console.log("AGOra-SDK--- accessDenied");
    });

    this.localStream.init(
      () => {
        console.log("AGOra-SDK--- getUserMedia successfully");
        this.localStream.play("agora_local");
        this.agoraService.client.publish(this.localStream, function (err: string) {
          console.log("AGOra-SDK--- Publish local stream error: " + err);
        });
        this.agoraService.client.on("stream-published", function (evt: any) {
          console.log("AGOra-SDK--- Publish local stream successfully");
        });
      },
      function (err: any) {
        console.log("AGOra-SDK--- getUserMedia failed", err);
      }
    );

    this.agoraService.client.on("error", (err: { reason: string; }) => {
       console.log("AGOra-SDK--- Got error msg:", err.reason);
      if (err.reason === "DYNAMIC_KEY_TIMEOUT") {
        this.agoraService.client.renewChannelKey(
          "",
          () => {
            console.log("AGOra-SDK--- Renew channel key successfully");
          },
          (err: any) => {
            console.log("AGOra-SDK--- Renew channel key failed: ", err);
          }
        );
      }
    });

    this.agoraService.client.on("stream-added", (evt: { stream: any; }) => {
      const stream = evt.stream;
      this.agoraService.client.subscribe(stream, (err: any) => {
        console.log("AGOra-SDK--- Subscribe stream failed", err);
      });
    });

    this.agoraService.client.on("stream-subscribed", (evt: { stream: any; }) => {
      const stream = evt.stream;
      if (!this.remoteCalls.includes(`agora_remote${stream.getId()}`))
        this.remoteCalls.push(`agora_remote${stream.getId()}`);
      setTimeout(() => stream.play(`agora_remote${stream.getId()}`), 2000);
    });

    this.agoraService.client.on("stream-removed", (evt: { stream: any; }) => {
      const stream = evt.stream;
      stream.stop();
      this.remoteCalls = this.remoteCalls.filter(
        (call: string) => call !== `#agora_remote${stream.getId()}`
      );
      console.log(`AGOra-SDK--- Remote stream is removed ${stream.getId()}`);
    });

    this.agoraService.client.on("peer-leave", (evt: { stream: any; uid: any; }) => {
      const stream = evt.stream;
      if (stream) {
        stream.stop();
        this.remoteCalls = this.remoteCalls.filter(
          (call: string) => call === `#agora_remote${stream.getId()}`
        );
        console.log(`AGOra-SDK--- ${evt.uid} left from this channel`);
      }
    });
  }

我尝试使用令牌和频道 ID 连接到视频 Steam。但无法连接到视频通话。即使我允许浏览器访问视频和音频。我希望连接到视频通话流并打开计算机的摄像头。没有星云主题,它工作得很好。

angularjs 打字稿 agora.io nebular

评论


答: 暂无答案