I have a cross platform agora app. The Mobile version is using the Agora React Native SDK while the web version is using the Web SDK v4. When I was implementing the audio mute / unmute indication I found that the event does not trigger from mobile to web. Can anyone please help me with this, what should I do to make it work?
// This is the Code From React Native
const toggleAudio = useCallback(async () => {
await RtcEngine.instance().enableLocalAudio(!audioEnabled);
setCurrentUser(prev => {
return { ...prev, audioEnabled: !audioEnabled }
})
setAudioEnabled(!audioEnabled);
}, [audioEnabled]);
And Here is the Web event Handler
client.on("user-unpublished", (user, type) => {
if (type === "audio") {
user.audioTrack?.stop();
setRemoteUsers(prev => {
return prev.map(ussr => ussr.uid == user.uid ? user : ussr);
})
}
if (type == 'video') {
setRemoteUsers(prev => {
return prev.map(ussr => ussr.uid == user.uid ? user : ussr);
})
}
});
The handler works for web to web and also for the video event on mobile but doesn’t trigger the callback for the audio