Compare commits
12
Commits
2e67987a44
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
04eba4de45 | ||
|
|
7bd03b5e5f | ||
|
|
fefad30ad5 | ||
|
|
9b14d8e9f0 | ||
|
|
2430f6e667 | ||
|
|
afe67ebdc1 | ||
|
|
c4cd464bfa | ||
|
|
08b103a26b | ||
|
|
f83d78ab4e | ||
|
|
242de19cf2 | ||
|
|
36f546eaba | ||
|
|
dcaf0f2f05 |
@@ -6,11 +6,6 @@ on:
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
env:
|
||||
VERSION_MAJOR: '1'
|
||||
VERSION_MINOR: '1'
|
||||
VERSION_PATCH: ${{ gitea.run_number }}
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
@@ -22,10 +17,10 @@ jobs:
|
||||
fetch-depth: 0
|
||||
fetch-tags: true
|
||||
|
||||
- name: Use NodeJS 24
|
||||
- name: Use Node.js 24.17.0
|
||||
uses: actions/setup-node@v6
|
||||
with:
|
||||
node-version: '24'
|
||||
node-version: '24.17.0'
|
||||
registry-url: 'https://registry.npmjs.org'
|
||||
package-manager-cache: false
|
||||
|
||||
@@ -33,8 +28,9 @@ jobs:
|
||||
run: npm ci
|
||||
|
||||
- name: Set Release Version
|
||||
id: version
|
||||
run: npm run version:place
|
||||
env:
|
||||
VERSION_PATCH: ${{ gitea.run_number }}
|
||||
|
||||
- name: Export Release Version
|
||||
id: release_version
|
||||
|
||||
@@ -15,10 +15,10 @@ jobs:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: use NodeJS 24
|
||||
- name: Use Node.js 24.17.0
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '24'
|
||||
node-version: '24.17.0'
|
||||
|
||||
- name: Install Dependencies
|
||||
run: npm ci
|
||||
|
||||
+1
-1
@@ -9,5 +9,5 @@
|
||||
"bracketSpacing": true,
|
||||
"bracketSameLine": false,
|
||||
"quoteProps": "as-needed",
|
||||
"endOfLine": "lf"
|
||||
"endOfLine": "auto"
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
# 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
|
||||
`@discordjs/voice` and ffmpeg.
|
||||
@@ -18,7 +18,7 @@ Create an [issue](https://git.lechner-systems.at/FrauJulian/Discord-Audio-Stream
|
||||
|
||||
## Installation
|
||||
|
||||
Node.js `24.x` is required.
|
||||
Node.js `>=24.17.0` and `<25` is required.
|
||||
|
||||
```bash
|
||||
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
|
||||
|
||||
| Option | Default |
|
||||
@@ -136,8 +139,8 @@ type AudioManagerOptions = {
|
||||
|
||||
| Method | Description |
|
||||
| ------------------------ | ---------------------------------------------------------------------------------- |
|
||||
| `setConnection(options)` | Replaces the voice connection target. |
|
||||
| `setSource(source)` | Replaces the audio source. |
|
||||
| `setConnection(options)` | Sets the target for the next `connect()` or `start()` call. |
|
||||
| `setSource(source)` | Sets the source for the next `play()` or `start()` call. |
|
||||
| `connect()` | Joins the configured Discord voice channel. |
|
||||
| `play(source?)` | Starts playback on an existing connection. |
|
||||
| `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
|
||||
and unrecoverable connections before invoking the callback.
|
||||
|
||||
`onError` does not handle rejected `connect()`, `play()`, or `start()` calls. Await and catch those calls explicitly.
|
||||
|
||||
## Development
|
||||
|
||||
```bash
|
||||
|
||||
Generated
+2
-2
@@ -7,7 +7,7 @@
|
||||
"": {
|
||||
"name": "discord-audio-stream",
|
||||
"version": "x.x.x",
|
||||
"license": "LGPL-3.0-only",
|
||||
"license": "AGPL-3.0-only",
|
||||
"devDependencies": {
|
||||
"@discordjs/opus": "^0.10.0",
|
||||
"@jest/globals": "^30.4.1",
|
||||
@@ -31,7 +31,7 @@
|
||||
"typescript": "npm:@typescript/typescript6@^6.0.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": "24.x"
|
||||
"node": ">=24.17.0 <25"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://ko-fi.com/FrauJulian"
|
||||
|
||||
+2
-2
@@ -2,7 +2,7 @@
|
||||
"$schema": "https://json.schemastore.org/package.json",
|
||||
"name": "discord-audio-stream",
|
||||
"version": "x.x.x",
|
||||
"license": "LGPL-3.0-only",
|
||||
"license": "AGPL-3.0-only",
|
||||
"description": "A small Discord voice audio streaming library with managed ffmpeg playback.",
|
||||
"exports": {
|
||||
".": {
|
||||
@@ -112,7 +112,7 @@
|
||||
"esbuild": "^0.28.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": "24.x"
|
||||
"node": ">=24.17.0 <25"
|
||||
},
|
||||
"private": false,
|
||||
"publishConfig": {
|
||||
|
||||
+7
-10
@@ -3,6 +3,8 @@ const fs = require('fs');
|
||||
const lockFilePath = 'package-lock.json';
|
||||
const packageFilePath = 'package.json';
|
||||
const placeholderVersion = 'x.x.x';
|
||||
const versionMajor = 1;
|
||||
const versionMinor = 2;
|
||||
const command = process.argv[2];
|
||||
|
||||
function readJson(path) {
|
||||
@@ -24,7 +26,7 @@ function getLockFile() {
|
||||
function writeVersions(version) {
|
||||
const pkg = readJson(packageFilePath);
|
||||
pkg.version = version;
|
||||
writeJson(packageFilePath, pkg, 2);
|
||||
writeJson(packageFilePath, pkg, 4);
|
||||
|
||||
const lock = getLockFile();
|
||||
|
||||
@@ -74,19 +76,14 @@ function fixPlaceholder() {
|
||||
}
|
||||
|
||||
function getCiVersion() {
|
||||
const major = process.env.VERSION_MAJOR;
|
||||
const minor = process.env.VERSION_MINOR;
|
||||
const patch = process.env.VERSION_PATCH;
|
||||
const segments = { major, minor, patch };
|
||||
|
||||
for (const [name, value] of Object.entries(segments)) {
|
||||
if (!/^\d+$/.test(value ?? '')) {
|
||||
console.error(`Missing or invalid ${name} version segment: "${value ?? ''}"`);
|
||||
process.exit(1);
|
||||
}
|
||||
if (!/^\d+$/.test(patch ?? '')) {
|
||||
console.error(`Missing or invalid patch version segment: "${patch ?? ''}"`);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
return `${major}.${minor}.${patch}`;
|
||||
return `${versionMajor}.${versionMinor}.${patch}`;
|
||||
}
|
||||
|
||||
if (command === 'check-placeholder') {
|
||||
|
||||
+3
-1
@@ -112,7 +112,7 @@ export type VolumeOptions = {
|
||||
/**
|
||||
* 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;
|
||||
};
|
||||
@@ -144,6 +144,7 @@ export type AudioManagerOptions = {
|
||||
* Milliseconds after which the manager reconnects and restarts playback.
|
||||
*
|
||||
* Renewal is disabled unless an interval is provided.
|
||||
* Numeric values must be integers from `1` through `2_147_483_647`.
|
||||
*
|
||||
* @defaultValue `false`
|
||||
*/
|
||||
@@ -151,6 +152,7 @@ export type AudioManagerOptions = {
|
||||
|
||||
/**
|
||||
* 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`
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user