我有: 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");
});
添加回答
举报
0/150
提交
取消