Mute / Unmute Mic - iOS
This feature allows hosts to communicate with each other during the livestream by enabling or disabling their microphones. While only hosts (participants in SEND_AND_RECV mode) can speak, audience members (in RECV_ONLY mode) can listen to the conversation in real time.
unmuteMic()
-
By using
unmuteMic()function ofMeetingclass, the host can publish their audio to other hosts and audience members. -
You can call this method when the local participant is not broadcasting any audio to others.
-
Audio stream of the participant can be accessed from the
onStreamEnabledevent ofParticipantEventListener.
muteMic()
- By using
muteMic()function ofMeetingclass, the host can stop publishing their audio to other hosts and audience members.
Example
Example
- Swift
@IBAction func micButtonTapped(_ sender: Any) {
if !micEnabled {
// enable/unmute mic
self.meeting?.unmuteMic()
} else {
// disable/mute mic
self.meeting?.muteMic()
}
}
Events associated with unmuteMic
- Every Participant will receive a callback on
onStreamEnabled()of theParticipantwithStreamobject.
Events associated with muteMic
- Every Participant will receive a callback on
onStreamDisabled()of theParticipantwithStreamobject.
Audio Permissions
Step 1:Begin by ensuring that your application has audio permission to access user's microphone device. Utilize thegetAudioPermissionStatus()method of theVideoSDKclass to verify if permissions are granted. If the permissions are not granted, the method will request the required permissions.
In case permissions are blocked by the user, the app's permission request dialogue cannot be re-rendered programmatically. In such cases, consider providing guidance to users on manually adjusting their application settings.
- Swift
let audioPermission = VideoSDK.getAudioPermissionStatus(); // audio permission status
Request Permissions
-
If permission status is
notDetermined, use thegetAudioPermission()methods of theVideoSDKclass to prompt users to grant access to their devices. -
Calling the above functions will automatically handle the notDetermined state and prompt the user to grant permission.
- Swift
class LiveStreamViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// UI Setup
setupUI()
// prompt user to grant permission when the app starts
VideoSDK.getAudioPermission()
}
func setupUI() {
// your UI code
}
}
API Reference
The API references for all the methods and events utilized in this guide are provided below.
Got a Question? Ask us on discord

