为了账号安全,请及时绑定邮箱和手机立即绑定

添加的流永远不会被 agora.io 触发

添加的流永远不会被 agora.io 触发

森栏 2022-08-18 16:40:33
我有:        this.agoraClient = AgoraRTC.createClient({ mode: "rtc", codec: "h264" })        this.agoraClient.on('stream-added', (evt) => {            console.log('SHAMOON added stream', evt)            this.remoteStream = evt.stream            this.agoraClient.subscribe(this.remoteStream)        })        this.agoraClient.on('stream-subscribed', (evt) => {            console.log('SHAMOON subscribed stream', evt)            this.remoteStream.play(this.remoteHtmlElementId, { muted: true });        })        await new Promise((resolve, reject) => this.agoraClient.init(this.appId, resolve, reject))        await new Promise((resolve, reject) => this.agoraClient.join(null, this.channelName, this.uid, resolve, reject))        this.localStream = AgoraRTC.createStream({            streamID: this.uid,            audio: true,            video: false,            screen: false        })        await new Promise(this.localStream.init)        this.localStream.play(this.localHtmlElementId, { muted: true })        console.log('playing local')        this.agoraClient.publish(this.localStream)        console.log('publishing local')它到达了,但永远不会被调用。我做错了什么?publishing localSHAMOON added stream
查看完整描述

1 回答

?
有只小跳蛙

TA贡献1824条经验 获得超8个赞

仅当将远程流添加到通道时,才会触发回调。要侦听的事件是将本地流添加到通道时的事件。stream-addedstream-published


this.agoraClient.on('stream-published', function (evt) {

  console.log("local stream published successfully");

});


查看完整回答
反对 回复 2022-08-18
  • 1 回答
  • 0 关注
  • 105 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信