@ikonai/sdk 0.0.16 → 0.0.19
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.
|
@@ -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
|
+
};
|
|
@@ -55,7 +55,6 @@ export declare class IkonAudioPlayback {
|
|
|
55
55
|
private readonly client;
|
|
56
56
|
private readonly config;
|
|
57
57
|
private enabled;
|
|
58
|
-
private prepared;
|
|
59
58
|
private stateUnsubscribe;
|
|
60
59
|
private readonly isIos;
|
|
61
60
|
private recreateOnNextResume;
|
|
@@ -79,17 +78,6 @@ export declare class IkonAudioPlayback {
|
|
|
79
78
|
private readonly fallbackQueues;
|
|
80
79
|
private readonly activeStreams;
|
|
81
80
|
constructor(client: IkonClient, config?: IkonAudioPlaybackConfig);
|
|
82
|
-
/**
|
|
83
|
-
* Prepare the audio pipeline without attempting to start playback.
|
|
84
|
-
*
|
|
85
|
-
* This is meant to reduce time-to-first-audio by:
|
|
86
|
-
* - creating the AudioContext (it may remain suspended)
|
|
87
|
-
* - loading the AudioWorklet module (if supported)
|
|
88
|
-
* - starting the decode worker when the client is connected
|
|
89
|
-
*
|
|
90
|
-
* Prewarming does not trigger user-gesture prompts and does not call resume().
|
|
91
|
-
*/
|
|
92
|
-
prepare(): Promise<void>;
|
|
93
81
|
/**
|
|
94
82
|
* Enable or disable audio playback.
|
|
95
83
|
*
|
|
@@ -129,6 +117,7 @@ export declare class IkonAudioPlayback {
|
|
|
129
117
|
private resumeWithTimeout;
|
|
130
118
|
private ensureAudioWorklet;
|
|
131
119
|
private ensureScriptProcessor;
|
|
120
|
+
private compactFallbackQueue;
|
|
132
121
|
private skipFromFallbackQueue;
|
|
133
122
|
private trimFallbackQueue;
|
|
134
123
|
private stopScriptProcessorDiagnostics;
|
|
@@ -142,6 +131,7 @@ export declare class IkonAudioPlayback {
|
|
|
142
131
|
private ensureWorkers;
|
|
143
132
|
private onAudioWorkerMessage;
|
|
144
133
|
private postToWorklet;
|
|
134
|
+
private enqueuePendingWorkletMessage;
|
|
145
135
|
private stopAudioWorklet;
|
|
146
136
|
private stopScriptProcessor;
|
|
147
137
|
private stopAudioGraph;
|