How to perform mute/unmute, mute audio, and disable camera operations on remote users?
Introduction
In real-time audio and video interaction, there is often a need for local users to perform operations on remote users. For example, in a voice chat room, the host may invite audience members to unmute and interact, and can mute users on the microphone to return them to regular audience members. In video conferences, the host can mute audio and disable cameras for participants.
Implementation Method
Before implementing local operations on remote users, please ensure that you have implemented the basic real-time audio and video functionality.
In ZEGO Express SDK, local operations on remote users are generally implemented by sending and receiving custom signals sendCustomCommand/onIMRecvCustomCommand combined with a business system designed by developers.
Mute/Unmute
Basic API sequence diagram for host inviting audience to unmute
Specific steps:
- Implement basic audio and video functionality
- Host sends unmute signal to specified audience member sendCustomCommand
- Audience member receives the signal onIMRecvCustomCommand
- Audience member starts publishing stream to unmute startPublishingStream
- Host receives room stream update onRoomStreamUpdate
- Host plays the specified audience member's stream startPlayingStream
Similarly, to implement the mute function, the audience member calls stopPublishingStream to stop publishing when receiving the mute signal.
Mute Audio/Disable Camera
API sequence diagram for local requiring remote to mute audio or disable camera
Similar to mute/unmute operations, the host and participants perform mute audio or disable camera operations by sending and receiving custom signals.
- Mute audio mutePublishStreamAudio
- Disable camera mutePublishStreamVideo
After the remote microphone and camera change, the local end will receive corresponding message callbacks where logic processing can be performed.
- Microphone onRemoteMicStateUpdate
- Camera onRemoteCameraStateUpdate
Precautions
If developers need to use ZEGO room user broadcast notification onRoomUserUpdate, please ensure that each user passes ZegoRoomConfig with the isUserStatusNotify property set to true when logging into the room, otherwise the callback notification will not be received.
