# Audio

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

The `ZMVideoSDKAudioHelper` provides methods to manage a user's audio. Before implementing audio controls, you must first check if the user is connected to audio or not by getting the audio type of the user. Start audio with `StartAudio()`.

```csharp
ZMVideoSDKUser myself = session.GetMySelf();
ZMVideoSDKAudioHelper audioHelper = ZMVideoSDK.Instance.GetAudioHelper();
ZMVideoSDKAudioStatus audioStatus = myself.GetAudioStatus();
if (audioStatus.audioType == ZMVideoSDKAudioType.ZMVideoSDKAudioType_None)
{
  audioHelper.StartAudio(result =>{});
} else {
  // The user is already connected to audio.
}
```

Once connected, you can mute a user's audio by calling `muteAudio` with the associated `ZoomVideoSDKUser` object.

```csharp
audioHelper.UnMuteAudio(myself, result => {});
```

You can also unmute a user's audio can also in a similar manner.

```csharp
audioHelper.MuteAudio(myself, result =>{});
```

To disconnect from audio, use the `stopAudio` method.

```csharp
audioHelper.StopVideo(result =>{});
```

## Callbacks

The following are examples of some audio callbacks in the `ZMVideoSDKDelegate` implementation class.

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

```csharp
public void onUserAudioStatusChanged(ZMVideoSDKAudioHelper audioHelper, List<ZMVideoSDKUser> userArray)
{
  foreach (ZMVideoSDKUser user in userArray)
  {
    bool isMuted = user.GetAudioStatus().isMuted;
  }
}
```

### Get notified when active audio changes

```csharp
public void onUserActiveAudioChanged(ZMVideoSDKAudioHelper audioHelper, List<ZMVideoSDKUser> userArray)
{
  foreach (ZMVideoSDKUser user in userArray)
  {
    bool isMuted = user.GetAudioStatus().isMuted;
  }
}
```

### Subscribe to users' audio raw data

```csharp
ZMVideoSDKAudioHelper audioHelper = ZMVideoSDK.Instance.GetAudioHelper();
audioHelper.Subscribe(res =>
{
  if (res == ZMVideoSDKErrors.ZMVideoSDKErrors_Success)
  {
    enableRawAudio = true;
  }
  Debug.Log("onUserAudioStatusChanged result = " + res);
});
```

### Get notified when mixed audio raw data is received

```csharp
public void onMixedAudioRawDataReceived(ZMVideoSDKAudioRawData audioRawData)
{
  // See raw data documentation for more information
}
```

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

```csharp
public void onOneWayAudioRawDataReceived(ZMVideoSDKAudioRawData audioRawData, ZMVideoSDKUser user)
{
  // See raw data documentation for more information
}
```
