# Listen for audio events

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

The Video SDK for iOS fires audio-related callbacks through `ZoomVideoSDKDelegate`. Conform to the delegate and implement the callbacks below to react to audio state changes in your session.

If you haven't already set up a delegate, see [Integrate](/docs/video-sdk/ios/integrate/) for details.

## Get notified when a user's audio status has changed

`onUserAudioStatusChanged` fires when a user mutes, unmutes, connects, or disconnects their audio.

```swift
func onUserAudioStatusChanged(_ helper: ZoomVideoSDKAudioHelper?, user userArray: [ZoomVideoSDKUser]?) {
    userArray?.forEach { user in
        // Use audioStatus().isMuted to check whether a user's audio is muted.
        if let userIsMuted = user.audioStatus()?.isMuted, userIsMuted {
            // User's audio is muted.
        }

        // Use audioStatus().audioType to obtain a user's audio type.
        if let audioType = user.audioStatus()?.audioType {
            print("User has audio type: \\(audioType)")
        }
    }
}
```

```objectivec
- (void)onUserAudioStatusChanged:(ZoomVideoSDKAudioHelper *)helper user:(NSArray<ZoomVideoSDKUser *> *)userArray {
    for (ZoomVideoSDKUser *user in userArray) {
        // Use audioStatus.isMuted to check whether a user's audio is muted.
        if (user.audioStatus.isMuted) {
            // User's audio is muted.
        }

        // Use audioStatus.audioType to obtain a user's audio type.
        NSLog(@"User has audio type: %lu", (unsigned long)user.audioStatus.audioType);
    }
}
```

## Get notified when a user's active audio changes

`onUserActiveAudioChanged` is different from `onUserAudioStatusChanged`. The SDK calls `onUserActiveAudioChanged` when a given user's audio changes, and it calls `onUserAudioStatusChanged` when the user's audio status changes. For example, if the user is unmuted and is using their device's microphone, `onUserActiveAudioChanged` is triggered whenever their microphone detects sound.

```swift
func onUserActiveAudioChanged(_ helper: ZoomVideoSDKUserHelper?, users userArray: [ZoomVideoSDKUser]?) {
    userArray?.forEach { user in
        // Use audioStatus().talking to see whether the user is currently talking.
        if let audioStatus = user.audioStatus(), audioStatus.talking, let userName = user.getName() {
            print("\\(userName) began talking.")
        }
    }
}
```

```objectivec
- (void)onUserActiveAudioChanged:(ZoomVideoSDKUserHelper *)helper users:(NSArray<ZoomVideoSDKUser *> *)userArray {
    for (ZoomVideoSDKUser *user in userArray) {
        // Use audioStatus.talking to see whether the user is currently talking.
        if (user.audioStatus.talking) {
            NSLog(@"%@ began talking.", user.getUserName);
        }
    }
}
```

## Get notified when mixed audio raw data is received

After you subscribe to raw audio, `onMixedAudioRawDataReceived` delivers the mixed audio of all users.

```swift
func onMixedAudioRawDataReceived(_ rawData: ZoomVideoSDKAudioRawData?) {
    // rawData contains the mixed PCM audio for all users.
}
```

```objectivec
- (void)onMixedAudioRawDataReceived:(ZoomVideoSDKAudioRawData *)rawData {
    // rawData contains the mixed PCM audio for all users.
}
```

## Get notified when one-way audio raw data is received

`onOneWayAudioRawDataReceived` delivers the raw audio of a single user.

```swift
func onOneWayAudioRawDataReceived(_ rawData: ZoomVideoSDKAudioRawData?, user: ZoomVideoSDKUser?) {
    // rawData contains the PCM audio for the given user.
}
```

```objectivec
- (void)onOneWayAudioRawDataReceived:(ZoomVideoSDKAudioRawData *)rawData user:(ZoomVideoSDKUser *)user {
    // rawData contains the PCM audio for the given user.
}
```

## Get notified when shared audio raw data is received

`onSharedAudioRawDataReceived` delivers the raw audio shared along with a screen share.

```swift
func onSharedAudioRawDataReceived(_ rawData: ZoomVideoSDKAudioRawData?) {
    // rawData contains the shared PCM audio.
}
```

```objectivec
- (void)onSharedAudioRawDataReceived:(ZoomVideoSDKAudioRawData *)rawData {
    // rawData contains the shared PCM audio.
}
```
