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 implement local mute / unmute / change volume level? #78

Closed fedotxxl closed 4 years ago

fedotxxl commented 4 years ago

I've found in the release notes that mute was replaced with setEnabled. Looks like setEnabled just destroys the local audio track. Does it mean that I should recreate it and reconnect it? Can you provide a working example with mute / unmute functionality?

HAHAHA44 commented 4 years ago

When you call setEnabled(false), the SDK will unpublish the track and destroy it. When you call setEnabled(true), the SDK will create the track and publish it. The only thing you need to do is to listen to the user-published event on the remote end to re-subscribe to this track.