@ikonai/sdk 0.0.15 → 0.0.18
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/assets/{audio-capture-worker-DbFwKRTJ.js → audio-capture-worker-C5hNMTF7.js} +1991 -1883
- package/assets/{audio-worker-BFOOU5sk.js → audio-worker-Ci3tYX2B.js} +1517 -1312
- package/assets/{protocol-worker-DIwctOUY.js → protocol-worker-DZqyPqA2.js} +1498 -1396
- package/assets/{video-capture-worker-CJhKrZYf.js → video-capture-worker-OBl3bsvx.js} +591 -489
- package/assets/{video-worker-BhoZnZ1o.js → video-worker-BoOfB8qz.js} +1232 -1130
- package/index.js +3221 -2635
- package/media/audio-worker-messages.d.ts +51 -0
- package/media/ikon-audio-playback.d.ts +21 -32
- package/media/ikon-video-playback.d.ts +0 -1
- package/media/ring-buffer.d.ts +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
export type AudioWorkerTransport = 'sab' | 'pcm';
|
|
2
|
+
export type AudioWorkerConfigureMessage = {
|
|
3
|
+
type: 'configure';
|
|
4
|
+
transport: AudioWorkerTransport;
|
|
5
|
+
outputSampleRate: number;
|
|
6
|
+
outputChannels: number;
|
|
7
|
+
preferWebCodecs?: boolean;
|
|
8
|
+
};
|
|
9
|
+
export type AudioWorkerAttachProtocolPortMessage = {
|
|
10
|
+
type: 'attachProtocolPort';
|
|
11
|
+
port: MessagePort;
|
|
12
|
+
};
|
|
13
|
+
export type AudioWorkerRebindMessage = {
|
|
14
|
+
type: 'rebind';
|
|
15
|
+
transport: AudioWorkerTransport;
|
|
16
|
+
outputSampleRate?: number;
|
|
17
|
+
outputChannels?: number;
|
|
18
|
+
};
|
|
19
|
+
export type AudioWorkerDisposeMessage = {
|
|
20
|
+
type: 'dispose';
|
|
21
|
+
};
|
|
22
|
+
export type AudioWorkerIn = AudioWorkerConfigureMessage | AudioWorkerAttachProtocolPortMessage | AudioWorkerRebindMessage | AudioWorkerDisposeMessage;
|
|
23
|
+
export type AudioWorkerOut = {
|
|
24
|
+
type: 'streamBegin';
|
|
25
|
+
streamId: string;
|
|
26
|
+
sharedArrayBuffer?: SharedArrayBuffer;
|
|
27
|
+
} | {
|
|
28
|
+
type: 'streamEnd';
|
|
29
|
+
streamId: string;
|
|
30
|
+
} | {
|
|
31
|
+
type: 'pcm';
|
|
32
|
+
streamId: string;
|
|
33
|
+
pcm: Float32Array;
|
|
34
|
+
} | {
|
|
35
|
+
type: 'error';
|
|
36
|
+
error: {
|
|
37
|
+
name: string;
|
|
38
|
+
message: string;
|
|
39
|
+
stack?: string;
|
|
40
|
+
};
|
|
41
|
+
streamId?: string;
|
|
42
|
+
} | {
|
|
43
|
+
type: 'frame';
|
|
44
|
+
streamId: string;
|
|
45
|
+
epoch: number;
|
|
46
|
+
tsInterleavedSamples: number;
|
|
47
|
+
frameSizeInterleavedSamples: number;
|
|
48
|
+
isFirst: boolean;
|
|
49
|
+
isLast: boolean;
|
|
50
|
+
jitterMs: number;
|
|
51
|
+
};
|
|
@@ -1,30 +1,23 @@
|
|
|
1
1
|
import { IkonClient } from '../client/ikon-client';
|
|
2
2
|
export interface IkonAudioOutputConfig {
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* Multi-stream normalization configuration.
|
|
5
5
|
*
|
|
6
|
-
*
|
|
7
|
-
* The decode worker resamples into the actual output rate used by the playback graph.
|
|
6
|
+
* When enabled, normalizes mixed output by the number of active streams.
|
|
8
7
|
*/
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
*
|
|
13
|
-
* This is used to normalize decoded streams into a single mixing format.
|
|
14
|
-
*/
|
|
15
|
-
channels?: number;
|
|
16
|
-
/**
|
|
17
|
-
* Startup buffer size (seconds).
|
|
18
|
-
*
|
|
19
|
-
* This is the minimum buffered audio required before playback begins after a reset.
|
|
20
|
-
*/
|
|
21
|
-
minBufferSizeSeconds?: number;
|
|
8
|
+
multiStreamNormalization?: {
|
|
9
|
+
enabled: boolean;
|
|
10
|
+
};
|
|
22
11
|
/**
|
|
23
|
-
*
|
|
12
|
+
* Audio debugging/diagnostics configuration.
|
|
24
13
|
*
|
|
25
|
-
*
|
|
14
|
+
* When enabled, logs audio events and periodic status information.
|
|
26
15
|
*/
|
|
27
|
-
|
|
16
|
+
diagnostics?: {
|
|
17
|
+
enabled: boolean;
|
|
18
|
+
/** Interval for periodic status logs in seconds. Default: 5 */
|
|
19
|
+
statusInterval?: number;
|
|
20
|
+
};
|
|
28
21
|
}
|
|
29
22
|
export interface IkonAudioPlaybackConfig {
|
|
30
23
|
/**
|
|
@@ -42,7 +35,6 @@ export interface IkonAudioPlaybackConfig {
|
|
|
42
35
|
* All of these have fallbacks for restrictive embed environments.
|
|
43
36
|
*/
|
|
44
37
|
threading?: {
|
|
45
|
-
decodeWorker?: 'auto' | 'disabled';
|
|
46
38
|
preferSharedArrayBuffer?: boolean;
|
|
47
39
|
preferAudioWorklet?: boolean;
|
|
48
40
|
preferWebCodecs?: boolean;
|
|
@@ -63,7 +55,6 @@ export declare class IkonAudioPlayback {
|
|
|
63
55
|
private readonly client;
|
|
64
56
|
private readonly config;
|
|
65
57
|
private enabled;
|
|
66
|
-
private prepared;
|
|
67
58
|
private stateUnsubscribe;
|
|
68
59
|
private readonly isIos;
|
|
69
60
|
private recreateOnNextResume;
|
|
@@ -74,9 +65,12 @@ export declare class IkonAudioPlayback {
|
|
|
74
65
|
/** Timeout for AudioContext.resume() - normally resolves instantly, but some browsers hang indefinitely */
|
|
75
66
|
private static readonly RESUME_TIMEOUT_MS;
|
|
76
67
|
private audioContext;
|
|
68
|
+
private outputSampleRateHz;
|
|
77
69
|
private audioWorkletNode;
|
|
78
70
|
private scriptProcessorNode;
|
|
71
|
+
private scriptDiagnosticsTimer;
|
|
79
72
|
private workletModuleUrl;
|
|
73
|
+
private workletModuleKey;
|
|
80
74
|
private workletReady;
|
|
81
75
|
private pendingWorkletMessages;
|
|
82
76
|
private audioWorker;
|
|
@@ -84,17 +78,6 @@ export declare class IkonAudioPlayback {
|
|
|
84
78
|
private readonly fallbackQueues;
|
|
85
79
|
private readonly activeStreams;
|
|
86
80
|
constructor(client: IkonClient, config?: IkonAudioPlaybackConfig);
|
|
87
|
-
/**
|
|
88
|
-
* Prepare the audio pipeline without attempting to start playback.
|
|
89
|
-
*
|
|
90
|
-
* This is meant to reduce time-to-first-audio by:
|
|
91
|
-
* - creating the AudioContext (it may remain suspended)
|
|
92
|
-
* - loading the AudioWorklet module (if supported)
|
|
93
|
-
* - starting the decode worker when the client is connected
|
|
94
|
-
*
|
|
95
|
-
* Prewarming does not trigger user-gesture prompts and does not call resume().
|
|
96
|
-
*/
|
|
97
|
-
prepare(): Promise<void>;
|
|
98
81
|
/**
|
|
99
82
|
* Enable or disable audio playback.
|
|
100
83
|
*
|
|
@@ -134,6 +117,11 @@ export declare class IkonAudioPlayback {
|
|
|
134
117
|
private resumeWithTimeout;
|
|
135
118
|
private ensureAudioWorklet;
|
|
136
119
|
private ensureScriptProcessor;
|
|
120
|
+
private compactFallbackQueue;
|
|
121
|
+
private skipFromFallbackQueue;
|
|
122
|
+
private trimFallbackQueue;
|
|
123
|
+
private stopScriptProcessorDiagnostics;
|
|
124
|
+
private ensureScriptProcessorDiagnostics;
|
|
137
125
|
private readFromFallbackQueue;
|
|
138
126
|
private resumeAudioContextIfPossible;
|
|
139
127
|
private recoverAudioContext;
|
|
@@ -143,6 +131,7 @@ export declare class IkonAudioPlayback {
|
|
|
143
131
|
private ensureWorkers;
|
|
144
132
|
private onAudioWorkerMessage;
|
|
145
133
|
private postToWorklet;
|
|
134
|
+
private enqueuePendingWorkletMessage;
|
|
146
135
|
private stopAudioWorklet;
|
|
147
136
|
private stopScriptProcessor;
|
|
148
137
|
private stopAudioGraph;
|
package/media/ring-buffer.d.ts
CHANGED