Reputation: 21
I have so much problems to run agora.io broadcast, the user enter to the link but instead to enter on the channel of the person who is broadcasting, is creating another channel.
I need to know how can I create a channel and another user enter to this channel.
I'm doing this.
this is my 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);
});
}
}
and this is my app.html
<div id="agora_local"> </div>
<button (click)="startCall()">Start Call</button> ```
Upvotes: 0
Views: 836
Reputation: 600
I was stuck in same problem for hours and I don't know why they haven't mentioned in angular-agora-rtc docs or ngx-agora but as mentioned in the Agora API documentation, role need to be set either as host or audience by
client.setClientRole(role)
For host you create local stream and publish it and for audience you only join the channel. reference here, https://docs.agora.io/en/Video/start_live_web
Upvotes: 1
Reputation: 1
Instead of this:
this.agoraService.client.join(null, '1000', null, (uid)
use:
this.agoraService.client.join(token, channel_name, null, (uid)
Upvotes: 0