AgoraIO-Community / AgoraWebSDK-NG

The Next Generation of Agora Web SDK
https://agoraio-community.github.io/AgoraWebSDK-NG/
161 stars 75 forks source link

How to use user-info-updated function in the js code ? #70

Closed ashokpal100 closed 4 years ago

ashokpal100 commented 4 years ago

Hi,

Please prove the solution of user-info-updated function implementation

user-info-updated(uid: UID, msg: "mute-audio" | "mute-video" | "enable-local-video" | "unmute-audio" | "unmute-video" | "disable-local-video"): void

disoul commented 4 years ago
client.on("user-info-updated", (uid, msg) => {
  switch (msg) {
    case "mute-audio":  ...
    case "mute-video":  ... 
  }
});

In most cases, you just need user-published and user-unpublished. This event is only used to receive Agora Native SDK's user info event

ashokpal100 commented 4 years ago
client.on("user-info-updated", (uid, msg) => {
  switch (msg) {
    case "mute-audio":  ...
    case "mute-video":  ... 
  }
});

In most cases, you just need user-published and user-unpublished. This event is only used to receive Agora Native SDK's user info event

thanks for the reply. ok got it =============== Agora sdk =============== mute local audio and video just call a localStream.muteAudio() localStream.unmuteAudio() localStream.unmuteVideo() localStream.muteVideo() these are works fine

=============== Agora NG sdk============= but how to mute local audio and video code below we have used client = AgoraRTC.createClient({ mode: "rtc", codec: "h264" }); client.on("user-published", handleUserPublished); client.on("user-unpublished", handleUserUnpublished); options.uid = await client.join(options.appid, options.channel, options.token || null); localTracks.audioTrack = await AgoraRTC.createMicrophoneAudioTrack(); localTracks.videoTrack = await AgoraRTC.createCameraVideoTrack() localTracks.videoTrack.play("local-player"); await client.publish(Object.values(localTracks)) above code working fine but not able to achieve mute or unmute local audio and video call

How to mute or unmute local audio and video call ? Please help

disoul commented 4 years ago

you can use setEnabled

ashokpal100 commented 4 years ago

you can use setEnabled

image

await localTracks.videoTrack.setEnabled(false) ?

disoul commented 4 years ago

Are you using v4.0.1 ?

ashokpal100 commented 4 years ago

Are you using v4.0.1 ?

Yes thanks for help im able to do all the things