@remedia/node 0.0.0-stage → 0.1.0-dev.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +89 -2
- package/THIRD_PARTY_LICENSES.txt +15655 -0
- package/THIRD_PARTY_NOTICES.md +126 -0
- package/dist/discord.d.ts +69 -0
- package/dist/discord.js +997 -0
- package/dist/events.d.ts +11 -0
- package/dist/events.js +18 -0
- package/dist/filters.d.ts +11 -0
- package/dist/filters.js +36 -0
- package/dist/gateway.d.ts +45 -0
- package/dist/gateway.js +81 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +4 -0
- package/dist/input.d.ts +20 -0
- package/dist/input.js +124 -0
- package/dist/lifecycle.d.ts +166 -0
- package/dist/lifecycle.js +73 -0
- package/dist/playback.d.ts +29 -0
- package/dist/playback.js +387 -0
- package/dist/remedia.d.ts +32 -0
- package/dist/remedia.js +132 -0
- package/dist/types.d.ts +48 -0
- package/dist/types.js +65 -0
- package/native.d.ts +162 -0
- package/native.js +778 -0
- package/package.json +86 -3
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
# Third-party notices
|
|
2
|
+
|
|
3
|
+
Remedia is licensed under MIT; see `LICENSE`. Third-party dependencies retain their own terms.
|
|
4
|
+
This page highlights the major components. The accompanying `THIRD_PARTY_LICENSES.txt` reproduces
|
|
5
|
+
additional upstream copyright notices, conditions, and disclaimers required for redistribution,
|
|
6
|
+
including native Rust dependencies, Unicode data, and the Rust standard library. Keep both notice
|
|
7
|
+
files with redistributed packages and binaries.
|
|
8
|
+
|
|
9
|
+
## FFmpeg 7 — independently installed runtime libraries
|
|
10
|
+
|
|
11
|
+
Remedia dynamically links FFmpeg 7. Consumers install the shared libraries independently; they are
|
|
12
|
+
not bundled in Remedia's npm packages or standalone server binaries. FFmpeg's licensing depends on
|
|
13
|
+
the selected build, enabled components, and external libraries. GPL-enabled builds are not rejected.
|
|
14
|
+
Users must comply with applicable licensing requirements for their chosen build and deployment.
|
|
15
|
+
See [official licensing information](https://ffmpeg.org/legal.html) and
|
|
16
|
+
[FFmpeg source code](https://git.ffmpeg.org/ffmpeg.git).
|
|
17
|
+
|
|
18
|
+
The Rust `ffmpeg-next` and `ffmpeg-sys-next` bindings have separate WTFPL terms, reproduced in the
|
|
19
|
+
license appendix; those terms do not apply to FFmpeg itself.
|
|
20
|
+
|
|
21
|
+
## libopus — statically included
|
|
22
|
+
|
|
23
|
+
`opus2` 0.4.0 uses `libopus_sys` 0.3.3 with the bundled libopus backend. Its Opus source is compiled
|
|
24
|
+
and statically linked into the native addon and standalone server. A system libopus is not needed.
|
|
25
|
+
The bundled source's `opus/COPYING` is reproduced verbatim below. See
|
|
26
|
+
[Opus source](https://gitlab.xiph.org/xiph/opus) and [official licensing](https://opus-codec.org/license/).
|
|
27
|
+
|
|
28
|
+
```text
|
|
29
|
+
Copyright 2001-2023 Xiph.Org, Skype Limited, Octasic,
|
|
30
|
+
Jean-Marc Valin, Timothy B. Terriberry,
|
|
31
|
+
CSIRO, Gregory Maxwell, Mark Borgerding,
|
|
32
|
+
Erik de Castro Lopo, Mozilla, Amazon
|
|
33
|
+
|
|
34
|
+
Redistribution and use in source and binary forms, with or without
|
|
35
|
+
modification, are permitted provided that the following conditions
|
|
36
|
+
are met:
|
|
37
|
+
|
|
38
|
+
- Redistributions of source code must retain the above copyright
|
|
39
|
+
notice, this list of conditions and the following disclaimer.
|
|
40
|
+
|
|
41
|
+
- Redistributions in binary form must reproduce the above copyright
|
|
42
|
+
notice, this list of conditions and the following disclaimer in the
|
|
43
|
+
documentation and/or other materials provided with the distribution.
|
|
44
|
+
|
|
45
|
+
- Neither the name of Internet Society, IETF or IETF Trust, nor the
|
|
46
|
+
names of specific contributors, may be used to endorse or promote
|
|
47
|
+
products derived from this software without specific prior written
|
|
48
|
+
permission.
|
|
49
|
+
|
|
50
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
51
|
+
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
52
|
+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
53
|
+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
|
|
54
|
+
OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
|
55
|
+
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
|
56
|
+
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
|
57
|
+
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
|
58
|
+
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
59
|
+
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
60
|
+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
61
|
+
|
|
62
|
+
Opus is subject to the royalty-free patent licenses which are
|
|
63
|
+
specified at:
|
|
64
|
+
|
|
65
|
+
Xiph.Org Foundation:
|
|
66
|
+
https://datatracker.ietf.org/ipr/1524/
|
|
67
|
+
|
|
68
|
+
Microsoft Corporation:
|
|
69
|
+
https://datatracker.ietf.org/ipr/1914/
|
|
70
|
+
|
|
71
|
+
Broadcom Corporation:
|
|
72
|
+
https://datatracker.ietf.org/ipr/1526/
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
The bundled source also supplies this `opus/LICENSE_PLEASE_READ.txt`:
|
|
76
|
+
|
|
77
|
+
```text
|
|
78
|
+
Contributions to the collaboration shall not be considered confidential.
|
|
79
|
+
|
|
80
|
+
Each contributor represents and warrants that it has the right and
|
|
81
|
+
authority to license copyright in its contributions to the collaboration.
|
|
82
|
+
|
|
83
|
+
Each contributor agrees to license the copyright in the contributions
|
|
84
|
+
under the Modified (2-clause or 3-clause) BSD License or the Clear BSD License.
|
|
85
|
+
|
|
86
|
+
Please see the IPR statements submitted to the IETF for the complete
|
|
87
|
+
patent licensing details:
|
|
88
|
+
|
|
89
|
+
Xiph.Org Foundation:
|
|
90
|
+
https://datatracker.ietf.org/ipr/1524/
|
|
91
|
+
|
|
92
|
+
Microsoft Corporation:
|
|
93
|
+
https://datatracker.ietf.org/ipr/1914/
|
|
94
|
+
|
|
95
|
+
Skype Limited:
|
|
96
|
+
https://datatracker.ietf.org/ipr/1602/
|
|
97
|
+
|
|
98
|
+
Broadcom Corporation:
|
|
99
|
+
https://datatracker.ietf.org/ipr/1526/
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
## Discord voice and cryptography
|
|
103
|
+
|
|
104
|
+
[DAVE (`davey` 0.2.0)](https://crates.io/crates/davey/0.2.0) and
|
|
105
|
+
[OpenMLS 0.8.3](https://crates.io/crates/openmls/0.8.3) provide native voice encryption components
|
|
106
|
+
under their upstream MIT terms. Native TLS/crypto also incorporates
|
|
107
|
+
[ring 0.17.14](https://crates.io/crates/ring/0.17.14), whose Apache-2.0 and ISC notices include
|
|
108
|
+
BoringSSL-derived code. Their actual license and copyright notices are in `THIRD_PARTY_LICENSES.txt`.
|
|
109
|
+
|
|
110
|
+
HPKE components are MPL-2.0 covered and used unmodified. Corresponding source is available from
|
|
111
|
+
these exact published archives: [hpke-rs 0.6.1](https://crates.io/api/v1/crates/hpke-rs/0.6.1/download),
|
|
112
|
+
[hpke-rs-crypto 0.6.1](https://crates.io/api/v1/crates/hpke-rs-crypto/0.6.1/download),
|
|
113
|
+
[hpke-rs-libcrux 0.6.1](https://crates.io/api/v1/crates/hpke-rs-libcrux/0.6.1/download), and
|
|
114
|
+
[hpke-rs-rust-crypto 0.6.1](https://crates.io/api/v1/crates/hpke-rs-rust-crypto/0.6.1/download).
|
|
115
|
+
The MPL-2.0 text is in the license appendix. Redistributors must preserve source availability and
|
|
116
|
+
applicable notices, including for any modifications they make.
|
|
117
|
+
|
|
118
|
+
## JavaScript runtime dependency
|
|
119
|
+
|
|
120
|
+
The client uses [ws 8.22.1](https://registry.npmjs.org/ws/-/ws-8.22.1.tgz), installed separately by
|
|
121
|
+
npm under MIT terms. Its full copyright and license text is in `THIRD_PARTY_LICENSES.txt`.
|
|
122
|
+
The packages compile with `tsc`; development tools and documentation-site dependencies are not
|
|
123
|
+
bundled into the npm libraries or standalone server.
|
|
124
|
+
|
|
125
|
+
Review these files when dependencies, native build options, or distributed artifacts change.
|
|
126
|
+
Their presence does not guarantee legal compliance.
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { RemediaEventEmitter } from './events.js';
|
|
2
|
+
import { PlaybackHooks, type PlayOptions, type SessionLifecycleEvents } from './lifecycle.js';
|
|
3
|
+
import { FilterControls } from './filters.js';
|
|
4
|
+
import type { MediaSource } from './input.js';
|
|
5
|
+
import type { AudioStreamInfo, PlaybackPosition, PlaybackState, VoiceConnectionState } from './types.js';
|
|
6
|
+
export interface DiscordSessionOptions {
|
|
7
|
+
/** Discord server snowflake as a decimal string. */
|
|
8
|
+
guildId: string;
|
|
9
|
+
/** Voice channel snowflake as a decimal string. */
|
|
10
|
+
channelId: string;
|
|
11
|
+
/** Bot user snowflake as a decimal string. */
|
|
12
|
+
userId: string;
|
|
13
|
+
}
|
|
14
|
+
export interface DiscordConnectOptions {
|
|
15
|
+
/** Abort the Gateway request and any pending connection attempt. */
|
|
16
|
+
signal?: AbortSignal;
|
|
17
|
+
/** Maximum time to receive Gateway credentials and establish voice transport/DAVE. */
|
|
18
|
+
timeoutMs?: number;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* One Discord voice session. The caller supplies a Gateway send adapter to `Remedia.create()` and
|
|
22
|
+
* forwards raw dispatch packets to `Remedia.receive()`; this session collects the matching voice
|
|
23
|
+
* credentials and opens the native transport after both dispatches arrive.
|
|
24
|
+
*/
|
|
25
|
+
export declare class DiscordSession<Metadata = unknown> extends RemediaEventEmitter<SessionLifecycleEvents<Metadata>> {
|
|
26
|
+
#private;
|
|
27
|
+
readonly sessionId: `${string}-${string}-${string}-${string}-${string}`;
|
|
28
|
+
readonly guildId: string;
|
|
29
|
+
readonly channelId: string;
|
|
30
|
+
readonly userId: string;
|
|
31
|
+
readonly filters: FilterControls;
|
|
32
|
+
readonly hooks: PlaybackHooks<Metadata>;
|
|
33
|
+
/** Current voice transport state. A connected voice WebSocket may temporarily be reconnecting. */
|
|
34
|
+
get connectionState(): VoiceConnectionState;
|
|
35
|
+
/** Most recent Gateway or native transport failure, if any. */
|
|
36
|
+
get connectionError(): string | null;
|
|
37
|
+
get state(): PlaybackState;
|
|
38
|
+
get position(): PlaybackPosition;
|
|
39
|
+
get durationMs(): number | null;
|
|
40
|
+
get error(): string | null;
|
|
41
|
+
/** Current normalized linear master gain, from 0.0 (mute) through 2.0. */
|
|
42
|
+
get volume(): number;
|
|
43
|
+
/** Current native source generation, useful to adapters that preserve event correlation. */
|
|
44
|
+
get generation(): number;
|
|
45
|
+
/** Set master gain independently of this session's configured filtergraph. */
|
|
46
|
+
setVolume(gain: number): Promise<void>;
|
|
47
|
+
/**
|
|
48
|
+
* Request a Gateway voice join and wait until both voice dispatches have arrived and the native
|
|
49
|
+
* voice transport has completed its DAVE setup. Repeated calls while connecting share a promise.
|
|
50
|
+
*/
|
|
51
|
+
connect(options?: DiscordConnectOptions): Promise<void>;
|
|
52
|
+
/**
|
|
53
|
+
* Begin playback on this connected voice session. The decoder and Opus encoder remain in core;
|
|
54
|
+
* this object only associates their output with the native Discord transport.
|
|
55
|
+
*/
|
|
56
|
+
play(source: MediaSource, options?: PlayOptions<Metadata>): Promise<AudioStreamInfo>;
|
|
57
|
+
pause(): Promise<void>;
|
|
58
|
+
resume(): Promise<void>;
|
|
59
|
+
seek(positionMs: number): Promise<void>;
|
|
60
|
+
stop(): Promise<void>;
|
|
61
|
+
wait(): Promise<PlaybackState>;
|
|
62
|
+
/**
|
|
63
|
+
* Leave the Discord channel through Gateway OP 4 and close the native transport. This does not
|
|
64
|
+
* dispose the wrapper, so `connect()` can be called again with fresh Gateway dispatches.
|
|
65
|
+
*/
|
|
66
|
+
disconnect(): Promise<void>;
|
|
67
|
+
/** Disconnect and unregister this session. */
|
|
68
|
+
dispose(): Promise<void>;
|
|
69
|
+
}
|