Closed MobeenAshraf closed 4 years ago
Have you read this migration guide about NG? The user-published
event will be fired when a remote user publishes an audio or video track (not local user). In NG, all the async operations are using Promise
, so there are no callbacks.
If you want to close your camera light, just close
and unpublish
your video track, then create a new video track and publish it:
let videoTrack = await AgoraRTC.createCameraVideoTrack();
await client.publish(videoTrack);
console.log("publish success");
// close camera light here
videoTrack.close();
await client.unpublish(videoTrack);
// re-create and publish your video track
videoTrack = await AgoraRTC.createCameraVideoTrack();
await client.publish(videoTrack);
The user-unpublished
event is not getting called on remote after I do this:
videoTrack.close();
await client.unpublish(videoTrack);
Have you called setMute
before unpublish? There is a known issue about call setMute
with unpublish
(#8), it may cause user-unpublished
event missing if you call LocalAudio.setMute(true)
. This issue has been fixed in develop branch and will be released next month.
If you did not call setMute
and your SDK version is 0.1.9
, this case is unexpected, please give me your sample codes to reproduce this issue.
Hi, Yes, it Seems that is the case.
I was calling unpublish after couple of seconds of setMute to make sure that the receivers get a black screen and don't have video frame stopped.
@MobeenAshraf I recommend that you modify the CSS of the receiver's DOM element when you receive the user-unpublished
event to get a black screen instead of calling setMute
.
Thanks @disoul, That helps
I am currently working on a demo where I can make video and audio mute options.
API already provides mute APIS but it doesn't provide video mute API which also closes Camera light.
From this link, I see it is possible with this SDK but when I try to re-init(publish) video stream after close() method, I don't get any
user-publish
event callback. https://docs.agora.io/en/faq/web_camera_light.I also intermittently get warning "SDK [WARNING]: [e0540] no need to update" where the video bool flag is set to false. THE NG SDK doesn't takes video/audio/screen bools from anywhere in code. As I understand, we could pass these option in agora-sdk
From logs, I can see that video track publishes but there is no effect on the viewer end
On further debugging, I noticed:
await this.client.unpublish([this.video])
neither throws any error nor calls any unPublishCallback for recievers