我有这么多的问题来运行agora.io广播,用户进入链接,而不是进入正在广播的人的频道,正在创建另一个频道。
我需要知道如何创建一个频道,并让另一个用户进入此频道。
我要这么做。
这是我的app.ts
title = 'agorademo';
localStream: Stream // Add
constructor(private agoraService: AngularAgoraRtcService) {
this.agoraService.createClient();
}
startCall() {
this.agoraService.client.join(null, '1000', null, (uid) => {
this.localStream = this.agoraService.createStream(uid, true, null, null, true, false);
this.localStream.setVideoProfile('720p_3');
this.subscribeToStreams();
});
}
private subscribeToStreams() {
this.localStream.on("accessAllowed", () => {
console.log("accessAllowed");
});
// The user has denied access to the camera and mic.
this.localStream.on("accessDenied", () => {
console.log("accessDenied");
});
this.localStream.init(() => {
console.log("getUserMedia successfully");
this.localStream.play('agora_local');
this.agoraService.client.publish(this.localStream, function (err) {
console.log("Publish local stream error: " + err);
});
this.agoraService.client.on('stream-published', function (evt) {
console.log("Publish local stream successfully");
});
}, function (err) {
console.log("getUserMedia failed", err);
});
}
} 这是我的app.html
<div id="agora_local"> </div>
<button (click)="startCall()">Start Call</button> ```发布于 2021-03-08 02:12:07
我被同样的问题困扰了几个小时,我不知道为什么他们在angular- Agora -rtc文档或ngx-agora文档中没有提到,但正如Agora API文档中所提到的,角色需要设置为主机或受众
client.setClientRole(role)对于主持人,您可以创建本地流并发布它;对于观众,您只需加入频道。在这里引用,https://docs.agora.io/en/Video/start_live_web
发布于 2020-04-14 00:17:57
而不是这样:
this.agoraService.client.join(null, '1000', null, (uid)使用:
this.agoraService.client.join(token, channel_name, null, (uid)https://stackoverflow.com/questions/58296531
复制相似问题