> ## Documentation Index
> Fetch the complete documentation index at: https://cometchat-22654f5b-docs-angular-v5-docs-update.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Sound Manager

> Manage CometChat iOS UI Kit sounds for incoming and outgoing messages, calls, custom audio files, playback, and pause controls.

<Accordion title="AI Integration Quick Reference">
  | Field        | Value                                                                    |
  | ------------ | ------------------------------------------------------------------------ |
  | Platform     | iOS UI Kit                                                               |
  | Class        | `CometChatSoundManager`                                                  |
  | Purpose      | Manages audio playback for messages and calls                            |
  | Play Method  | `play(sound: Sound, customSound: URL?)`                                  |
  | Pause Method | `pause()`                                                                |
  | Sound Types  | `.incomingMessage`, `.outgoingMessage`, `.incomingCall`, `.outgoingCall` |
  | Custom Sound | Pass `URL` to override default sounds                                    |
</Accordion>

## Overview

`CometChatSoundManager` is a helper class that manages audio playback in the CometChat UI Kit. It handles sound events for incoming and outgoing messages and calls, supporting both default sounds and custom audio files.

***

## Methods

### Play Sound

The `play(sound:customSound:)` method triggers audio playback based on user interactions with the chat interface. If no custom sound file is provided, the default sound for that event type is played.

```swift lines theme={null}
play(sound: Sound, customSound: URL?)
```

| Parameter   | Type  | Description                                                                                              |
| ----------- | ----- | -------------------------------------------------------------------------------------------------------- |
| sound       | Sound | The type of sound event (e.g., `.incomingMessage`, `.outgoingMessage`, `.incomingCall`, `.outgoingCall`) |
| customSound | URL?  | Optional URL to a custom sound file. If `nil`, the default sound is used.                                |

### Pause Sound

The `pause()` method stops any sound currently being played by the SoundManager.

```swift lines theme={null}
pause()
```

***

## Usage

### Playing Default Sounds

Play the default sound for an incoming message:

<Tabs>
  <Tab title="Swift">
    ```swift lines theme={null}
    // Play the default incoming message sound
    CometChatSoundManager().play(sound: .incomingMessage)
    ```
  </Tab>
</Tabs>

### Playing Custom Sounds

Provide a custom audio file URL to override the default sound:

<Tabs>
  <Tab title="Swift">
    ```swift lines theme={null}
    // Play a custom sound for incoming messages
    if let customSoundURL = Bundle.main.url(forResource: "customSound", withExtension: "wav") {
        CometChatSoundManager().play(sound: .incomingMessage, customSound: customSoundURL)
    }
    ```
  </Tab>
</Tabs>

### Pausing Sounds

Stop any currently playing sound:

<Tabs>
  <Tab title="Swift">
    ```swift lines theme={null}
    // Pause the currently playing sound
    CometChatSoundManager().pause()
    ```
  </Tab>
</Tabs>

***

## Sound Types

The `Sound` enum provides the following options:

| Sound Type         | Description                              |
| ------------------ | ---------------------------------------- |
| `.incomingMessage` | Played when a new message is received    |
| `.outgoingMessage` | Played when a message is sent            |
| `.incomingCall`    | Played when an incoming call is received |
| `.outgoingCall`    | Played when initiating an outgoing call  |

***

By using `CometChatSoundManager`, you can enhance the user experience in your chat application by integrating audible cues for chat interactions.

***

## Next Steps

<CardGroup cols={3}>
  <Card title="Theme Introduction" href="/ui-kit/ios/theme-introduction">
    Customize the visual appearance
  </Card>

  <Card title="Localization" href="/ui-kit/ios/localize">
    Adapt to different languages
  </Card>

  <Card title="Component Styling" href="/ui-kit/ios/component-styling">
    Style individual components
  </Card>
</CardGroup>
