# Best practices

<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->

These recommendations help you ship a reliable audio experience with the Video SDK for iOS.

## Permissions

The SDK cannot capture from the microphone until the user has granted microphone access. Add an `NSMicrophoneUsageDescription` entry to your `Info.plist` and request permission _before_ you call `startAudio`.

-   Request microphone access at the moment the user takes an action that needs audio (such as tapping a "Join audio" button), not at app launch. The prompt feels justified when it's tied to a clear action.
-   If the user denies access, surface a clear message and a path to retry. For example, open `UIApplication.openSettingsURLString` so they can grant the permission in Settings.
-   If you also need video, add an `NSCameraUsageDescription` entry and request camera access at the same time.

See [Requesting authorization to capture and save media](https://developer.apple.com/documentation/avfoundation/capture_setup/requesting_authorization_to_capture_and_save_media) for the iOS permission flow.

## Enable audio with a clear action

Tie the call to `startAudio` to a visible, user-initiated action like a "Join audio" or microphone button. This makes it easy for users to understand when they're connected to session audio and matches what they expect from native calling apps.

## Show mute and talking status

-   Render each user's mute state from their `ZoomVideoSDKAudioStatus` so participants can see at a glance who is muted. Implement [`onUserAudioStatusChanged`](/docs/video-sdk/ios/audio/audio-events/#get-notified-when-a-users-audio-status-has-changed) and re-render when it fires.
-   Animate the microphone icon while a user is talking. Use the [`onUserActiveAudioChanged`](/docs/video-sdk/ios/audio/audio-events/#get-notified-when-a-users-active-audio-changes) callback together with `audioStatus.talking` to drive the animation. This gives users confirmation that their mic is capturing their voice.
-   Highlight the active speaker in your video grid, for example by bordering their tile, so participants can see who is currently speaking.

## Audio routing

On iOS, audio routing between the receiver, speaker, and connected headsets or Bluetooth devices is managed by the system through [`AVAudioSession`](https://developer.apple.com/documentation/avfaudio/avaudiosession).

-   Configure an appropriate category (such as `.playAndRecord`) and route as part of your app's audio session setup.
-   Observe `AVAudioSession.routeChangeNotification` so you can update the UI when the user connects or disconnects a headset mid-call.

## Handle host-ask-unmute on the client

When the host calls `unmuteAudio` on a remote user, the target device receives [`onHostAskUnmute`](/docs/video-sdk/ios/audio/host-controls/#ask-a-single-user-to-unmute). Always show the user a confirmation prompt, never silently turn on their microphone. Calling `unmuteAudio` on the local user without the user's explicit acknowledgment violates the user's expectation of mic privacy.

## Lifecycle

-   The SDK keeps audio running while your app is backgrounded, so you typically should _not_ call `stopAudio` when the app moves to the background. Only stop audio when the user explicitly leaves the session.
-   To keep capturing audio in the background, enable the **Audio, AirPlay, and Picture in Picture** background mode in your target's capabilities.
-   Keep audio-related state in your view model so view reloads don't tear down your audio UI.

## Sound options

Leave [original sound](/docs/video-sdk/ios/audio/sound-options/) disabled unless your use case specifically needs unprocessed audio. The SDK's default audio processing (echo cancellation, noise suppression) produces a better experience for general voice communication. Enable original sound for music, broadcasting, or other content where the SDK's processing would degrade the source.

## Permission changes mid-session

If the user disables the microphone permission while a session is running, audio capture silently stops. Re-check microphone authorization when your app returns to the foreground and surface a clear message asking the user to re-grant the permission and rejoin audio.
