Update README for clarity and formatting

This commit is contained in:
2025-12-17 08:20:50 +01:00
committed by GitHub
parent 199f9f84c5
commit 4447437fd2
+20 -22
View File
@@ -18,7 +18,7 @@ versions!**
> the override methods provided. To finally start, use the respective method. For each call and each change, retrieve the > the override methods provided. To finally start, use the respective method. For each call and each change, retrieve the
> AudioManager object from the list and perform your actions. When the feature get stopped, first execute StopConnection > AudioManager object from the list and perform your actions. When the feature get stopped, first execute StopConnection
> and then Dispose to save as much power as possible. Garbage collection does the rest. > and then Dispose to save as much power as possible. Garbage collection does the rest.
> **For large systems:** For large systems, it is recommended to queue each start with the > **For large features:** For large systems, it is recommended to queue each start with the
> packet [p-queue](https://www.npmjs.com/package/p-queue), to give ffmpeg enough time.. > packet [p-queue](https://www.npmjs.com/package/p-queue), to give ffmpeg enough time..
## 👋 Support ## 👋 Support
@@ -41,31 +41,29 @@ bun add discord-audio-stream
#### Required Dependencies #### Required Dependencies
- > You only need to install `libsodium-wrappers` if your system does not support `aes-256-gcm` (verify by running - > You only need to install [`libsodium-wrappers`](https://www.npmjs.com/package/libsodium-wrappers) if your system does not support `aes-256-gcm` (verify by running `require('node:crypto').getCiphers().includes('aes-256-gcm')`).
> `require('node:crypto').getCiphers().includes('aes-256-gcm')`). - [`@snazzah/davey`](https://www.npmjs.com/package/@snazzah/davey)
- `@snazzah/davey` - [`opusscript`](https://www.npmjs.com/package/opusscript)
- `opusscript` - [`prism-media`](https://www.npmjs.com/package/prism-media)
- `prism-media` - [@discordjs/voice](https://www.npmjs.com/package/@discordjs/voice)
- **FFmpeg** (one of those) - **FFmpeg** (one of those)
- [`FFmpeg`](https://ffmpeg.org/) (installed and added to environment) - [`FFmpeg`](https://ffmpeg.org/) (environment) - *recommended*
- `ffmpeg-static` - [`FFmpeg-static`](https://www.npmjs.com/package/ffmpeg-static) (library)
### AudioManager Instance ### AudioManager Instance
#### Options #### Constructor
**Declaration:**
``` ```
AudioManager(ffmpegMode: string, renewInMs, number, connectionData: VoiceConnectionDataModel, audioData: VoiceAudioDataModel): IDisposable, IAudioManager AudioManager(ffmpegMode: string, renewInMs, number, connectionData: VoiceConnectionDataModel, audioData: VoiceAudioDataModel): IDisposable, IAudioManager
``` ```
- `ffmpegMode`: 'Native' or 'Standalone' - `ffmpegMode`: 'Native' or 'Standalone'
- Native: [`FFmpeg`](https://ffmpeg.org/) installed on your system - Native: [`FFmpeg`](https://ffmpeg.org/) (environment)
- Standalone: FFmpeg-static as NodeJs library - Standalone: [`FFmpeg-static`](https://www.npmjs.com/package/ffmpeg-static) (library)
- `renewInMs`: renewal time > default is 1,5h (5400000ms) - `renewInMs`: renewal time, default 1,5h = 5400000ms - optional
- `connectionData`: Options for voice connection. (type of **VoiceConnectionDataModel**) - `connectionData`: options for voice connection - optional
- `audioData`: Options for audio player. (type of **VoiceAudioDataModel**) - `audioData`: options for audio player - optional
#### Example #### Example
@@ -98,15 +96,15 @@ let audioManager = new AudioManager(
| Name | Parameters | Return type | Description | | Name | Parameters | Return type | Description |
| ----------------------------- | ------------------------------------------------------- | ------------- | ---------------------------------------- | | ----------------------------- | ------------------------------------------------------- | ------------- | ---------------------------------------- |
| `OverrideVoiceConnectionData` | `connectionData` (type of **VoiceConnectionDataModel**) | void | To override intern connectionData field. | | `OverrideVoiceConnectionData` | `connectionData`: **VoiceConnectionDataModel** | void | To override intern connectionData field. |
| `OverrideVoiceAudioDataModel` | `audioData` (type of **VoiceAudioDataModel**) | void | To override intern audioData field. | | `OverrideVoiceAudioDataModel` | `audioData`: **VoiceAudioDataModel** | void | To override intern audioData field. |
| `CreateAndPlay` | | Promise<void> | Join channel and start playing audio. | | `CreateAndPlay` | | Promise void | Join channel and start playing audio. |
| `CreateConnection` | | void | Let it connect to voice channel. | | `CreateConnection` | | void | Let it connect to voice channel. |
| `PlayAudio` | | Promise<void> | To start playing audio. | | `PlayAudio` | | Promise void | To start playing audio. |
| `PauseAudio` | | void | Pause the audio, if it is playing | | `PauseAudio` | | void | Pause the audio, if it is playing |
| `ResumeAudio` | | void | Resume the audio, if it is paused. | | `ResumeAudio` | | void | Resume the audio, if it is paused. |
| `SetVolume` | `volume` (type of number, 0 - 100 percent) | void | To set the audio volume. | | `SetVolume` | `volume`: number (0 - 100 percent) | void | To set the audio volume. |
| `StopConnection` | | Promise<void> | Method to disconnect the voice channel. | | `StopConnection` | | Promise void | Method to disconnect the voice channel. |
| `Dispose` | | void | Dispose all data in object. | | `Dispose` | | void | Dispose all data in object. |
## 📝 Types ## 📝 Types