Compare commits
6
Commits
dcaf0f2f05
...
afe67ebdc1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
afe67ebdc1 | ||
|
|
c4cd464bfa | ||
|
|
08b103a26b | ||
|
|
f83d78ab4e | ||
|
|
242de19cf2 | ||
|
|
36f546eaba |
@@ -22,10 +22,10 @@ jobs:
|
|||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
fetch-tags: true
|
fetch-tags: true
|
||||||
|
|
||||||
- name: Use NodeJS 24
|
- name: Use Node.js 24.17.0
|
||||||
uses: actions/setup-node@v6
|
uses: actions/setup-node@v6
|
||||||
with:
|
with:
|
||||||
node-version: '24'
|
node-version: '24.17.0'
|
||||||
registry-url: 'https://registry.npmjs.org'
|
registry-url: 'https://registry.npmjs.org'
|
||||||
package-manager-cache: false
|
package-manager-cache: false
|
||||||
|
|
||||||
|
|||||||
@@ -15,10 +15,10 @@ jobs:
|
|||||||
- name: Checkout Repository
|
- name: Checkout Repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: use NodeJS 24
|
- name: Use Node.js 24.17.0
|
||||||
uses: actions/setup-node@v4
|
uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: '24'
|
node-version: '24.17.0'
|
||||||
|
|
||||||
- name: Install Dependencies
|
- name: Install Dependencies
|
||||||
run: npm ci
|
run: npm ci
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
# Discord Audio Stream
|
# Discord Audio Stream
|
||||||
|
|
||||||
[](http://npmjs.org/package/discord-audio-stream)
|
[](https://www.npmjs.com/package/discord-audio-stream)
|
||||||

|

|
||||||

|

|
||||||
|
|
||||||
`discord-audio-stream` is a small TypeScript library for managed Discord voice playback through
|
`discord-audio-stream` is a small TypeScript library for managed Discord voice playback through
|
||||||
`@discordjs/voice` and ffmpeg.
|
`@discordjs/voice` and ffmpeg.
|
||||||
@@ -18,7 +18,7 @@ Create an [issue](https://git.lechner-systems.at/FrauJulian/Discord-Audio-Stream
|
|||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
Node.js `24.x` is required.
|
Node.js `>=24.17.0` and `<25` is required.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
npm install discord-audio-stream @discordjs/voice @discordjs/opus
|
npm install discord-audio-stream @discordjs/voice @discordjs/opus
|
||||||
@@ -123,6 +123,9 @@ type AudioManagerOptions = {
|
|||||||
};
|
};
|
||||||
```
|
```
|
||||||
|
|
||||||
|
`connectTimeoutMs` and numeric `renewIntervalMs` values must be whole milliseconds from `1` through `2_147_483_647`.
|
||||||
|
`volume.initialPercent` must be a finite number from `0` through `100` and requires `volume.enabled: true`.
|
||||||
|
|
||||||
### Defaults
|
### Defaults
|
||||||
|
|
||||||
| Option | Default |
|
| Option | Default |
|
||||||
@@ -136,8 +139,8 @@ type AudioManagerOptions = {
|
|||||||
|
|
||||||
| Method | Description |
|
| Method | Description |
|
||||||
| ------------------------ | ---------------------------------------------------------------------------------- |
|
| ------------------------ | ---------------------------------------------------------------------------------- |
|
||||||
| `setConnection(options)` | Replaces the voice connection target. |
|
| `setConnection(options)` | Sets the target for the next `connect()` or `start()` call. |
|
||||||
| `setSource(source)` | Replaces the audio source. |
|
| `setSource(source)` | Sets the source for the next `play()` or `start()` call. |
|
||||||
| `connect()` | Joins the configured Discord voice channel. |
|
| `connect()` | Joins the configured Discord voice channel. |
|
||||||
| `play(source?)` | Starts playback on an existing connection. |
|
| `play(source?)` | Starts playback on an existing connection. |
|
||||||
| `start()` | Connects and starts playback. |
|
| `start()` | Connects and starts playback. |
|
||||||
@@ -200,6 +203,8 @@ operations, such as calling `pause()` while nothing is playing, throw `AudioMana
|
|||||||
Use `onError` to observe asynchronous audio player and voice connection errors. The manager cleans up failed playback
|
Use `onError` to observe asynchronous audio player and voice connection errors. The manager cleans up failed playback
|
||||||
and unrecoverable connections before invoking the callback.
|
and unrecoverable connections before invoking the callback.
|
||||||
|
|
||||||
|
`onError` does not handle rejected `connect()`, `play()`, or `start()` calls. Await and catch those calls explicitly.
|
||||||
|
|
||||||
## Development
|
## Development
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
|||||||
Generated
+1
-1
@@ -31,7 +31,7 @@
|
|||||||
"typescript": "npm:@typescript/typescript6@^6.0.2"
|
"typescript": "npm:@typescript/typescript6@^6.0.2"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": "24.x"
|
"node": ">=24.17.0 <25"
|
||||||
},
|
},
|
||||||
"funding": {
|
"funding": {
|
||||||
"url": "https://ko-fi.com/FrauJulian"
|
"url": "https://ko-fi.com/FrauJulian"
|
||||||
|
|||||||
+1
-1
@@ -112,7 +112,7 @@
|
|||||||
"esbuild": "^0.28.2"
|
"esbuild": "^0.28.2"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": "24.x"
|
"node": ">=24.17.0 <25"
|
||||||
},
|
},
|
||||||
"private": false,
|
"private": false,
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
|
|||||||
+3
-1
@@ -112,7 +112,7 @@ export type VolumeOptions = {
|
|||||||
/**
|
/**
|
||||||
* Initial volume percentage applied when playback starts.
|
* Initial volume percentage applied when playback starts.
|
||||||
*
|
*
|
||||||
* Requires `enabled: true`.
|
* Must be a finite number from `0` through `100` and requires `enabled: true`.
|
||||||
*/
|
*/
|
||||||
initialPercent?: number;
|
initialPercent?: number;
|
||||||
};
|
};
|
||||||
@@ -144,6 +144,7 @@ export type AudioManagerOptions = {
|
|||||||
* Milliseconds after which the manager reconnects and restarts playback.
|
* Milliseconds after which the manager reconnects and restarts playback.
|
||||||
*
|
*
|
||||||
* Renewal is disabled unless an interval is provided.
|
* Renewal is disabled unless an interval is provided.
|
||||||
|
* Numeric values must be integers from `1` through `2_147_483_647`.
|
||||||
*
|
*
|
||||||
* @defaultValue `false`
|
* @defaultValue `false`
|
||||||
*/
|
*/
|
||||||
@@ -151,6 +152,7 @@ export type AudioManagerOptions = {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Maximum milliseconds to wait for the Discord voice connection to become ready.
|
* Maximum milliseconds to wait for the Discord voice connection to become ready.
|
||||||
|
* Must be an integer from `1` through `2_147_483_647`.
|
||||||
*
|
*
|
||||||
* @defaultValue `20_000`
|
* @defaultValue `20_000`
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user