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

# Sound Manager

> Sound Manager — CometChat documentation.

`CometChatSoundManager` provides functionalities for managing audio playback for incoming / outgoing messages in 1:1 or group chat.

## Audio resources

| Name                     | Description                                                             |
| ------------------------ | ----------------------------------------------------------------------- |
| incomingMessage          | The audio resource for an incoming message in an active chat            |
| outgoingMessage          | The audio resource for an outgoing message                              |
| incomingMessageFromOther | The audio resource for an incoming message received in an inactive chat |
| incomingCall             | The audio resource for an incoming call in an active 1:1 or group chat  |
| outgoingCall             | The audio resource for outgoing call in an active 1:1 or group chat     |

## Methods

### play

`CometChatSoundManager.play` method plays the in-built sounds audio resources for the above mentioned enum cases. It also allows for customisation of the audio resources. You can pass a mp3 file asset path of your choice.

| Name | Description                                            |
| ---- | ------------------------------------------------------ |
| play | This method plays the above mentioned audio resources. |

### pause

`CometChatSoundManager.pause` method pauses the ongoing audio resource for calls or messages

| Name  | Description                                                 |
| ----- | ----------------------------------------------------------- |
| pause | This method pauses the already being played audio resource. |

## Usage

<Tabs>
  <Tab title="JavaScript">
    ```javascript theme={null}
    //Trigger the audio sound for an incoming message
    CometChatSoundManager.play(Sound.incomingMessage);

    //Trigger the audio sound of your choice for an incoming message
    CometChatSoundManager.play(Sound.incomingMessage, "MP3_FILE_ASSET_PATH");

    //Pause the ongoing audio sound
    CometChatSoundManager.pause();
    ```
  </Tab>
</Tabs>
