# Manage in-meeting audio settings > The code on this page works with either the **default UI** or the **custom UI**. Through the SDK, let individual users manage their own various audio settings and control their in-meeting audio state. Additionally, meeting hosts can manage settings for other users and for the meeting as a whole. Most of the functionality is done through `ZoomSDKAudioSetting`, which can be accessed after the participant joins the meeting. ```swift if let audioSetting = ZoomSDK.shared().getSettingService()?.getAudioSetting() { } ``` ```objectivec ZoomSDKAudioSetting *audioSetting = [[[ZoomSDK sharedSDK] getSettingService] getAudioSetting]; if (audioSetting) { } ``` ## Connect to meeting audio Before joining a meeting, enable or disable auto connect to the meeting audio with VOIP. ```swift audioSetting.enableAutoJoinVoip(true) ``` ```objectivec [audioSetting enableAutoJoinVoip:YES]; ``` You can also update the current meeting's meeting settings to mute by default when joining the meeting, using `ZoomSDKAudioSetting`'s `enableMuteMicJoinVoip`. Unless the meeting explicitly prevents participants from unmuting themselves, any client instances can override this behavior. ```swift audioSetting.enableMuteMicJoinVoip(true) ``` ```objectivec [audioSetting enableMuteMicJoinVoip:YES]; ``` After joining a meeting, the SDK instance may not automatically connect to the meeting audio. To send or receive audio in the meeting, connect the SDK to the audio channel. ```swift if let myself = ZoomSDK.shared().getMeetingService()?.getMeetingActionController().getMyself() { if myself.getAudioType() == ZoomSDKAudioType_None { if let meetingService = ZoomSDK.shared().getMeetingService() { meetingService.getMeetingActionController().actionMeeting(with: ActionMeetingCmd_JoinVoip, userID: 0, on: ScreenType_First) } } } ``` ```objectivec ZoomSDKUserInfo *myself = [[[[ZoomSDK sharedSDK] getMeetingService] getMeetingActionController] getMyself]; if (myself && [myself getAudioType] == ZoomSDKAudioType_None) { ZoomSDKMeetingService *meetingService = [[ZoomSDK sharedSDK] getMeetingService]; if (meetingService) { [[meetingService getMeetingActionController] actionMeetingWithCmd:ActionMeetingCmd_JoinVoip userID:0 onScreen:ScreenType_First]; } } ``` Once connected, the SDK can also disconnect from the audio channel. After disconnecting from audio, the SDK won't be able to send or receive audio until it reconnects. ```swift if let myself = ZoomSDK.shared().getMeetingService()?.getMeetingActionController().getMyself() { if myself.getAudioType() == ZoomSDKAudioType_Voip { if let meetingService = ZoomSDK.shared().getMeetingService() { meetingService.getMeetingActionController().actionMeeting(with: ActionMeetingCmd_LeaveVoip, userID: 0, on: ScreenType_First) } } } ``` ```objectivec ZoomSDKUserInfo *myself = [[[[ZoomSDK sharedSDK] getMeetingService] getMeetingActionController] getMyself]; if (myself && [myself getAudioType] == ZoomSDKAudioType_Voip) { ZoomSDKMeetingService *meetingService = [[ZoomSDK sharedSDK] getMeetingService]; if (meetingService) { [[meetingService getMeetingActionController] actionMeetingWithCmd:ActionMeetingCmd_LeaveVoip userID:0 onScreen:ScreenType_First]; } } ``` Check whether a specific user is connected to the audio channel by checking their audio type against `ZoomSDKAudioType` constants. `ZoomSDKAudioType_Voip` means that they're connected to the meeting audio channel, `ZoomSDKAudioType_Phone` means that they're using audio from their phone, and `ZoomSDKAudioType_None` means that they aren't connected to audio. ```swift let user: ZoomSDKUserInfo user.getAudioType // OR let userAudioStatus: ZoomSDKUserAudioStatus userAudioStatus.getType ``` ```objectivec ZoomSDKUserInfo *user; user.getAudioType // OR ZoomSDKUserAudioStatus userAudioStatus; userAudioStatus.getType; ``` Depending on your audio connection, you can also hide the audio dialog that appears when joining the meeting when you are not connected to audio using `ZoomSDKPremeetingService`. ```swift if let preMeetingService = ZoomSDK.shared().getPremeetingService() { preMeetingService.disableAutoShowSelectJoinAudioDlg(whenJoinMeeting: true) } ``` ```objectivec ZoomSDKPremeetingService *preMeetingService = [[ZoomSDK sharedSDK] getPremeetingService]; if (preMeetingService) { [preMeetingService disableAutoShowSelectJoinAudioDlgWhenJoinMeeting: YES]; } ``` ## Managing audio speaker Get the list of available speakers using `getAudioSetting` with the mic parameter as false, and check which of the speakers is selected based on its `isSelectedDevice` state. Then call the `selectAudioDevice` with the mic parameter as false to change to another speaker. ```swift if let speakerList = audioSetting.getAudioDeviceList(false) as? [SDKDeviceInfo] { for device in speakerList { if device.isSelectedDevice() { print("Selected speaker: \(device.getDeviceName()) - \(device.getDeviceID())") } } } audioSetting.selectAudioDevice(false, deviceID: "Device_ID", deviceName: "Device_Name") ``` ```objectivec ZoomSDKAudioSetting *audioSetting = [[[ZoomSDK sharedSDK] getSettingService] getAudioSetting]; if (audioSetting) { NSArray* microphoneList = [audioSetting getAudioDeviceList:NO]; for (SDKDeviceInfo* device in microphoneList) { if (device.isSelectedDevice) { NSLog(@"Selected mic: %@ - %@", [device getDeviceName], [device getDeviceID]); } } [audioSetting selectAudioDevice:NO DeviceID:@"Device_ID" DeviceName:@"Device_Name"]; } ``` ## Managing audio microphone Get the list of available speakers using `getAudioSetting` with the mic parameter as true, and check which of the speakers is selected based on its `isSelectedDevice` state. Then call `selectAudioDevice` with the mic parameter as true to change to another speaker. ```swift if let microphoneList = audioSetting.getAudioDeviceList(true) as? [SDKDeviceInfo] { for device in microphoneList { if device.isSelectedDevice() { print("Selected mic: \(device.getDeviceName()) - \(device.getDeviceID())") } } } audioSetting.selectAudioDevice(true, deviceID: "Device_ID", deviceName: "Device_Name") ``` ```objectivec if (audioSetting) { NSArray* microphoneList = [audioSetting getAudioDeviceList:YES]; for (SDKDeviceInfo* device in microphoneList) { if (device.isSelectedDevice) { NSLog(@"Selected mic: %@ - %@", [device getDeviceName], [device getDeviceID]); } } [audioSetting selectAudioDevice:YES DeviceID:@"Device_ID" DeviceName:@"Device_Name"]; } ``` ## Mute or unmute audio Mute the local user's audio with `ZoomSDKMeetingActionController` using `actionMeetingWithCmd` with the parameter `ActionMeetingCmd_MuteAudio`. Additionally, if the meeting supports participants unmuting their own audio, use the parameter `ActionMeetingCmd_UnMuteAudio`. ```swift meetingService.getMeetingActionController().actionMeeting(with: ActionMeetingCmd_MuteAudio, userID: 0, on: ScreenType_First) if meetingService.getMeetingActionController().isParticipantsUnmuteSelfAllowed() { meetingService.getMeetingActionController().actionMeeting(with: ActionMeetingCmd_UnMuteAudio, userID: 0, on: ScreenType_First) } ``` ```objectivec // Mute [[meetingService getMeetingActionController] actionMeetingWithCmd:ActionMeetingCmd_MuteAudio userID:0 onScreen:ScreenType_First]; // Unmute if ([meetingService getMeetingActionController].isParticipantsUnmuteSelfAllowed) { [[meetingService getMeetingActionController] actionMeetingWithCmd:ActionMeetingCmd_UnMuteAudio userID:0 onScreen:ScreenType_First]; } ``` If the current user is the meeting's host, they can mute the other meeting participants' audio. For privacy reasons, the host cannot force another participant to unmute their audio. If the user is currently muted, this code asks them to unmute their microphone. ```swift meetingService.getMeetingActionController().actionMeeting(with: ActionMeetingCmd_MuteAudio, userID: "USER_ID", on: ScreenType_First) ``` ```objectivec [[meetingService getMeetingActionController] actionMeetingWithCmd:ActionMeetingCmd_MuteAudio userID:@"USER_ID" onScreen:ScreenType_First]; ``` The host can also mute all attendees' audio simultaneously. ```swift // Host/co-host to mute all meetingService.getMeetingActionController().actionMeeting(with: ActionMeetingCmd_MuteAll, userID: 0, on: ScreenType_First) /* Host/co-host to ask to unmute all - This will trigger the ZoomSDKMeetingActionControllerDelegate's onHostAskUnmute callback */ meetingService.getMeetingActionController().actionMeeting(with: ActionMeetingCmd_UnmuteAll, userID: 0, on: ScreenType_First) ``` ```objectivec // Host/co-host to mute all [[meetingService getMeetingActionController] actionMeetingWithCmd:ActionMeetingCmd_MuteAll userID:0 onScreen:ScreenType_First]; /* Host/co-host to ask to unmute all - This will trigger the ZoomSDKMeetingActionControllerDelegate's onHostAskUnmute callback */ [[meetingService getMeetingActionController] actionMeetingWithCmd:ActionMeetingCmd_UnmuteAll userID:0 onScreen:ScreenType_First]; ``` ## Stop incoming audio The SDK supports stopping your device from receiving audio while staying connected to the audio channel. This lets your microphone continue capturing audio and sending it to other meeting participants, and prevents your device from playing any audio produced by others. ```swift let meetingActionCtrl = meetingService.getMeetingActionController() meetingActionCtrl.stopIncomingAudio(!meetingActionCtrl.isIncomingAudioStopped()) ``` ```objectivec ZoomSDKMeetingActionController *meetingActionCtrl = [meetingService getMeetingActionController]; [meetingActionCtrl stopIncomingAudio: !meetingActionCtrl.isIncomingAudioStopped]; ``` ---