@4players/odin-plugin-web 1.0.0-alpha.22 → 1.0.0-alpha.24
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/lib/plugin/index.d.ts +127 -61
- package/lib/plugin/index.js +1 -405
- package/lib/worker/shared.js +1 -0
- package/lib/worker/unshared.js +1 -0
- package/package.json +22 -19
- package/lib/common/msgpack.d.ts +0 -2
- package/lib/common/msgpack.js +0 -117
- package/lib/plugin/config.d.ts +0 -12
- package/lib/plugin/config.js +0 -22
- package/lib/plugin/connectionPool.d.ts +0 -17
- package/lib/plugin/connectionPool.js +0 -130
- package/lib/plugin/deviceManager.d.ts +0 -12
- package/lib/plugin/deviceManager.js +0 -120
- package/lib/plugin/h3/mainConnection.d.ts +0 -30
- package/lib/plugin/h3/mainConnection.js +0 -196
- package/lib/plugin/mainConnection.d.ts +0 -30
- package/lib/plugin/mainConnection.js +0 -23
- package/lib/plugin/mediaController.d.ts +0 -66
- package/lib/plugin/mediaController.js +0 -215
- package/lib/plugin/medias/audio-capture.d.ts +0 -30
- package/lib/plugin/medias/audio-capture.js +0 -224
- package/lib/plugin/medias/audio-playback.d.ts +0 -13
- package/lib/plugin/medias/audio-playback.js +0 -40
- package/lib/plugin/medias/video-capture.d.ts +0 -15
- package/lib/plugin/medias/video-capture.js +0 -69
- package/lib/plugin/medias/video-playback.d.ts +0 -13
- package/lib/plugin/medias/video-playback.js +0 -20
- package/lib/plugin/roomConnection.d.ts +0 -40
- package/lib/plugin/roomConnection.js +0 -320
- package/lib/plugin/rpcConnection.d.ts +0 -57
- package/lib/plugin/rpcConnection.js +0 -281
- package/lib/plugin/token.d.ts +0 -13
- package/lib/plugin/token.js +0 -66
- package/lib/plugin/webrtc/mainConnection.d.ts +0 -52
- package/lib/plugin/webrtc/mainConnection.js +0 -455
- package/lib/plugin/webrtc/websocket.d.ts +0 -3
- package/lib/plugin/webrtc/websocket.js +0 -56
- package/lib/wasm/index.d.ts +0 -97
- package/lib/worker/buffers.d.ts +0 -42
- package/lib/worker/buffers.js +0 -79
- package/lib/worker/common.d.ts +0 -45
- package/lib/worker/common.js +0 -7
- package/lib/worker/config.d.ts +0 -8
- package/lib/worker/config.js +0 -11
- package/lib/worker/index.d.ts +0 -3
- package/lib/worker/index.js +0 -1
- package/lib/worker/memory.d.ts +0 -9
- package/lib/worker/memory.js +0 -29
- package/lib/worker/messages.d.ts +0 -14
- package/lib/worker/messages.js +0 -15
- package/lib/worker/packet.d.ts +0 -11
- package/lib/worker/packet.js +0 -59
- package/lib/worker/shared/capture.d.ts +0 -27
- package/lib/worker/shared/capture.js +0 -63
- package/lib/worker/shared/index.d.ts +0 -3
- package/lib/worker/shared/index.js +0 -147
- package/lib/worker/shared/messages.d.ts +0 -67
- package/lib/worker/shared/messages.js +0 -64
- package/lib/worker/shared/playback.d.ts +0 -20
- package/lib/worker/shared/playback.js +0 -78
- package/lib/worker/unshared/capture.d.ts +0 -27
- package/lib/worker/unshared/capture.js +0 -66
- package/lib/worker/unshared/index.d.ts +0 -3
- package/lib/worker/unshared/index.js +0 -170
- package/lib/worker/unshared/messages.d.ts +0 -81
- package/lib/worker/unshared/messages.js +0 -80
- package/lib/worker/unshared/playback.d.ts +0 -22
- package/lib/worker/unshared/playback.js +0 -83
package/lib/plugin/index.d.ts
CHANGED
|
@@ -1,64 +1,130 @@
|
|
|
1
|
-
import { Backend } from '@4players/odin-common';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
import { AudioPlayback } from './medias/audio-playback';
|
|
9
|
-
import JoinRoomParameters = Backend.JoinRoomParameters;
|
|
10
|
-
import Cipher = Backend.Cipher;
|
|
11
|
-
export type { LogFilters } from '@4players/odin-common';
|
|
12
|
-
export { logger } from './config';
|
|
13
|
-
type Plugin = Backend.Plugin;
|
|
14
|
-
export interface DeviceParameters {
|
|
15
|
-
readonly device?: Device;
|
|
16
|
-
onStatusChanged?: Backend.OnStatusChanged;
|
|
1
|
+
import { Backend, LogRecord, Logger } from '@4players/odin-common';
|
|
2
|
+
|
|
3
|
+
export interface DecoderSlot {
|
|
4
|
+
index: number;
|
|
5
|
+
connectionId: number;
|
|
6
|
+
mediaId: number;
|
|
7
|
+
volume?: number;
|
|
17
8
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
9
|
+
declare namespace Common {
|
|
10
|
+
type CaptureWorkletMessages = {
|
|
11
|
+
init: {
|
|
12
|
+
workerPort: MessagePort;
|
|
13
|
+
};
|
|
14
|
+
close: void;
|
|
15
|
+
dump: {
|
|
16
|
+
result: MessagePort;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
type PlaybackWorkletMessages = {
|
|
20
|
+
init: {
|
|
21
|
+
workerPort: MessagePort;
|
|
22
|
+
};
|
|
23
|
+
samples: {
|
|
24
|
+
id: number;
|
|
25
|
+
buffer: Float32Array;
|
|
26
|
+
};
|
|
27
|
+
close: void;
|
|
28
|
+
dump: {
|
|
29
|
+
result: MessagePort;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
type WorkerMessages = {
|
|
33
|
+
captureInit: {
|
|
34
|
+
sampleRate: number;
|
|
35
|
+
workletPort: MessagePort;
|
|
36
|
+
};
|
|
37
|
+
captureSetMedias: {
|
|
38
|
+
connections: Array<{
|
|
39
|
+
id: number;
|
|
40
|
+
mediaIds: number[];
|
|
41
|
+
}>;
|
|
42
|
+
};
|
|
43
|
+
captureSetVad: VadConfig;
|
|
44
|
+
captureTick: {};
|
|
45
|
+
playbackInit: {
|
|
46
|
+
workletPort: MessagePort;
|
|
47
|
+
};
|
|
48
|
+
playbackUpdateMedias: {
|
|
49
|
+
added: Array<DecoderSlot>;
|
|
50
|
+
removed: Array<DecoderSlot>;
|
|
51
|
+
};
|
|
52
|
+
playbackReceivePacket: {
|
|
53
|
+
connectionId: number;
|
|
54
|
+
packet: Uint8Array;
|
|
55
|
+
};
|
|
56
|
+
playbackTick: {};
|
|
57
|
+
close: void;
|
|
58
|
+
dump: {
|
|
59
|
+
result: MessagePort;
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
type MainMessages = {
|
|
63
|
+
sendPacket: {
|
|
64
|
+
connectionId: number;
|
|
65
|
+
packet: Uint8Array;
|
|
66
|
+
};
|
|
67
|
+
captureReady: {};
|
|
68
|
+
playbackReady: {};
|
|
69
|
+
stats: {
|
|
70
|
+
playback?: {
|
|
71
|
+
numberPackets: number;
|
|
72
|
+
numberPacketsMediaNotFound: number;
|
|
73
|
+
numberTicks: number;
|
|
74
|
+
numberPacketError: number;
|
|
75
|
+
numberTicksWithAudio: number;
|
|
76
|
+
};
|
|
77
|
+
capture?: {
|
|
78
|
+
numberPackets: number;
|
|
79
|
+
numberPacketsMediaNotFound: number;
|
|
80
|
+
numberTicks: number;
|
|
81
|
+
numberPacketError: number;
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
};
|
|
37
85
|
}
|
|
38
|
-
export
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
get token(): string;
|
|
49
|
-
get cipher(): Cipher | undefined;
|
|
50
|
-
request(method: string, properties: unknown): Promise<unknown>;
|
|
51
|
-
link(media: Backend.Media): Promise<void>;
|
|
52
|
-
unlink(media: Backend.Media): void;
|
|
53
|
-
close(): void;
|
|
54
|
-
private _HandleEvent;
|
|
55
|
-
private _HandleKnownEvent;
|
|
56
|
-
private _HandleConnectionLost;
|
|
57
|
-
private _HandleRoomUpdate;
|
|
58
|
-
private _HandleRoomJoined;
|
|
59
|
-
private _HandlePeerUpdate;
|
|
60
|
-
private _HandlePeerJoined;
|
|
61
|
-
private _HandlePeerLeft;
|
|
62
|
-
private _HandleMediaStart;
|
|
63
|
-
private _HandleMediaStopped;
|
|
86
|
+
export type OnLogMessage = (formattedString: string, record: LogRecord) => void;
|
|
87
|
+
export interface VadConfig {
|
|
88
|
+
volumeGate?: {
|
|
89
|
+
attackThreshold: number;
|
|
90
|
+
releaseThreshold: number;
|
|
91
|
+
};
|
|
92
|
+
voiceActivity?: {
|
|
93
|
+
attackThreshold: number;
|
|
94
|
+
releaseThreshold: number;
|
|
95
|
+
};
|
|
64
96
|
}
|
|
97
|
+
export type ConnectionStats = {
|
|
98
|
+
numberRecvDatagrams: number;
|
|
99
|
+
numberRecvDatagramsNoMediaIds: number;
|
|
100
|
+
numberRecvDatagramsNoEntry: number;
|
|
101
|
+
numberRecvDatagramsDecryptInvalid: number;
|
|
102
|
+
mainConnectionIdHistory: number[];
|
|
103
|
+
};
|
|
104
|
+
export type AudioContextFactory = (sampleRate: number | undefined) => Promise<AudioContext>;
|
|
105
|
+
export type MoreConnectionStats = ConnectionStats & {
|
|
106
|
+
numberAudioChannelMessages: number;
|
|
107
|
+
};
|
|
108
|
+
export interface WebDevice extends Backend.Device {
|
|
109
|
+
readonly device: MediaDeviceInfo;
|
|
110
|
+
}
|
|
111
|
+
export interface WebDeviceParameters extends Backend.DeviceParameters {
|
|
112
|
+
readonly device?: WebDevice;
|
|
113
|
+
onStatusChanged?: Backend.OnStatusChanged;
|
|
114
|
+
}
|
|
115
|
+
export declare function createPlugin(audioContextFactory: AudioContextFactory, options?: WebPluginOptions): WebPlugin;
|
|
116
|
+
export interface WebPluginOptions {
|
|
117
|
+
logger?: Logger;
|
|
118
|
+
onLogMessage?: OnLogMessage;
|
|
119
|
+
}
|
|
120
|
+
export interface WebPlugin extends Backend.Plugin {
|
|
121
|
+
joinRoom(parameters: Backend.JoinRoomParameters): WebRoom;
|
|
122
|
+
enumerateDevices(): Promise<WebDevice[]>;
|
|
123
|
+
setOutputDevice(device: WebDeviceParameters): Promise<void>;
|
|
124
|
+
getAudioPlaybackStats(): undefined | Common.MainMessages["stats"]["playback"];
|
|
125
|
+
getConnectionStats(): MoreConnectionStats;
|
|
126
|
+
}
|
|
127
|
+
export interface WebRoom extends Backend.Room {
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
export {};
|