audio-channel-queue 1.5.0 → 1.7.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/src/info.ts CHANGED
@@ -1,262 +1,387 @@
1
- /**
2
- * @fileoverview Audio information and progress tracking functions for the audio-channel-queue package
3
- */
4
-
5
- import {
6
- AudioInfo,
7
- QueueSnapshot,
8
- ProgressCallback,
9
- QueueChangeCallback,
10
- AudioStartCallback,
11
- AudioCompleteCallback,
12
- ExtendedAudioQueueChannel
13
- } from './types';
14
- import { getAudioInfoFromElement, createQueueSnapshot } from './utils';
15
- import { setupProgressTracking, cleanupProgressTracking } from './events';
16
-
17
- /**
18
- * Global array of extended audio queue channels
19
- */
20
- export const audioChannels: ExtendedAudioQueueChannel[] = [];
21
-
22
- /**
23
- * Gets current audio information for a specific channel
24
- * @param channelNumber - The channel number (defaults to 0)
25
- * @returns AudioInfo object or null if no audio is playing
26
- * @example
27
- * ```typescript
28
- * const info = getCurrentAudioInfo(0);
29
- * if (info) {
30
- * console.log(`Currently playing: ${info.fileName}`);
31
- * console.log(`Progress: ${(info.progress * 100).toFixed(1)}%`);
32
- * }
33
- * ```
34
- */
35
- export const getCurrentAudioInfo = (channelNumber: number = 0): AudioInfo | null => {
36
- const channel: ExtendedAudioQueueChannel = audioChannels[channelNumber];
37
- if (!channel || channel.queue.length === 0) {
38
- return null;
39
- }
40
-
41
- const currentAudio: HTMLAudioElement = channel.queue[0];
42
- return getAudioInfoFromElement(currentAudio);
43
- };
44
-
45
- /**
46
- * Gets audio information for all channels
47
- * @returns Array of AudioInfo objects (null for channels with no audio)
48
- * @example
49
- * ```typescript
50
- * const allInfo = getAllChannelsInfo();
51
- * allInfo.forEach((info, channel) => {
52
- * if (info) {
53
- * console.log(`Channel ${channel}: ${info.fileName}`);
54
- * }
55
- * });
56
- * ```
57
- */
58
- export const getAllChannelsInfo = (): (AudioInfo | null)[] => {
59
- const allChannelsInfo: (AudioInfo | null)[] = [];
60
-
61
- for (let i = 0; i < audioChannels.length; i++) {
62
- allChannelsInfo.push(getCurrentAudioInfo(i));
63
- }
64
-
65
- return allChannelsInfo;
66
- };
67
-
68
- /**
69
- * Gets a complete snapshot of the queue state for a specific channel
70
- * @param channelNumber - The channel number
71
- * @returns QueueSnapshot object or null if channel doesn't exist
72
- * @example
73
- * ```typescript
74
- * const snapshot = getQueueSnapshot(0);
75
- * if (snapshot) {
76
- * console.log(`Queue has ${snapshot.totalItems} items`);
77
- * console.log(`Currently playing: ${snapshot.items[0]?.fileName}`);
78
- * }
79
- * ```
80
- */
81
- export const getQueueSnapshot = (channelNumber: number): QueueSnapshot | null => {
82
- return createQueueSnapshot(channelNumber, audioChannels);
83
- };
84
-
85
- /**
86
- * Subscribes to real-time progress updates for a specific channel
87
- * @param channelNumber - The channel number
88
- * @param callback - Function to call with audio info updates
89
- * @example
90
- * ```typescript
91
- * onAudioProgress(0, (info) => {
92
- * updateProgressBar(info.progress);
93
- * updateTimeDisplay(info.currentTime, info.duration);
94
- * });
95
- * ```
96
- */
97
- export const onAudioProgress = (channelNumber: number, callback: ProgressCallback): void => {
98
- if (!audioChannels[channelNumber]) {
99
- audioChannels[channelNumber] = {
100
- audioCompleteCallbacks: new Set(),
101
- audioStartCallbacks: new Set(),
102
- progressCallbacks: new Map(),
103
- queue: [],
104
- queueChangeCallbacks: new Set()
105
- };
106
- }
107
-
108
- const channel: ExtendedAudioQueueChannel = audioChannels[channelNumber];
109
- if (!channel.progressCallbacks) {
110
- channel.progressCallbacks = new Map();
111
- }
112
-
113
- // Add callback for current audio if exists
114
- if (channel.queue.length > 0) {
115
- const currentAudio: HTMLAudioElement = channel.queue[0];
116
- if (!channel.progressCallbacks.has(currentAudio)) {
117
- channel.progressCallbacks.set(currentAudio, new Set());
118
- }
119
- channel.progressCallbacks.get(currentAudio)!.add(callback);
120
-
121
- // Set up tracking if not already done
122
- setupProgressTracking(currentAudio, channelNumber, audioChannels);
123
- }
124
-
125
- // Store callback for future audio elements in this channel
126
- if (!channel.progressCallbacks.has(null as any)) {
127
- channel.progressCallbacks.set(null as any, new Set());
128
- }
129
- channel.progressCallbacks.get(null as any)!.add(callback);
130
- };
131
-
132
- /**
133
- * Removes progress listeners for a specific channel
134
- * @param channelNumber - The channel number
135
- * @example
136
- * ```typescript
137
- * offAudioProgress(0); // Stop receiving progress updates for channel 0
138
- * ```
139
- */
140
- export const offAudioProgress = (channelNumber: number): void => {
141
- const channel: ExtendedAudioQueueChannel = audioChannels[channelNumber];
142
- if (!channel || !channel.progressCallbacks) return;
143
-
144
- // Clean up event listeners for current audio if exists
145
- if (channel.queue.length > 0) {
146
- const currentAudio: HTMLAudioElement = channel.queue[0];
147
- cleanupProgressTracking(currentAudio, channelNumber, audioChannels);
148
- }
149
-
150
- // Clear all callbacks for this channel
151
- channel.progressCallbacks.clear();
152
- };
153
-
154
- /**
155
- * Subscribes to queue change events for a specific channel
156
- * @param channelNumber - The channel number to monitor
157
- * @param callback - Function to call when queue changes
158
- * @example
159
- * ```typescript
160
- * onQueueChange(0, (snapshot) => {
161
- * updateQueueDisplay(snapshot.items);
162
- * updateQueueCount(snapshot.totalItems);
163
- * });
164
- * ```
165
- */
166
- export const onQueueChange = (channelNumber: number, callback: QueueChangeCallback): void => {
167
- if (!audioChannels[channelNumber]) {
168
- audioChannels[channelNumber] = {
169
- audioCompleteCallbacks: new Set(),
170
- audioStartCallbacks: new Set(),
171
- progressCallbacks: new Map(),
172
- queue: [],
173
- queueChangeCallbacks: new Set()
174
- };
175
- }
176
-
177
- const channel: ExtendedAudioQueueChannel = audioChannels[channelNumber];
178
- if (!channel.queueChangeCallbacks) {
179
- channel.queueChangeCallbacks = new Set();
180
- }
181
-
182
- channel.queueChangeCallbacks.add(callback);
183
- };
184
-
185
- /**
186
- * Removes queue change listeners for a specific channel
187
- * @param channelNumber - The channel number
188
- * @example
189
- * ```typescript
190
- * offQueueChange(0); // Stop receiving queue change notifications for channel 0
191
- * ```
192
- */
193
- export const offQueueChange = (channelNumber: number): void => {
194
- const channel: ExtendedAudioQueueChannel = audioChannels[channelNumber];
195
- if (!channel || !channel.queueChangeCallbacks) return;
196
-
197
- channel.queueChangeCallbacks.clear();
198
- };
199
-
200
- /**
201
- * Subscribes to audio start events for a specific channel
202
- * @param channelNumber - The channel number to monitor
203
- * @param callback - Function to call when audio starts playing
204
- * @example
205
- * ```typescript
206
- * onAudioStart(0, (info) => {
207
- * showNowPlaying(info.fileName);
208
- * setTotalDuration(info.duration);
209
- * });
210
- * ```
211
- */
212
- export const onAudioStart = (channelNumber: number, callback: AudioStartCallback): void => {
213
- if (!audioChannels[channelNumber]) {
214
- audioChannels[channelNumber] = {
215
- audioCompleteCallbacks: new Set(),
216
- audioStartCallbacks: new Set(),
217
- progressCallbacks: new Map(),
218
- queue: [],
219
- queueChangeCallbacks: new Set()
220
- };
221
- }
222
-
223
- const channel: ExtendedAudioQueueChannel = audioChannels[channelNumber];
224
- if (!channel.audioStartCallbacks) {
225
- channel.audioStartCallbacks = new Set();
226
- }
227
-
228
- channel.audioStartCallbacks.add(callback);
229
- };
230
-
231
- /**
232
- * Subscribes to audio complete events for a specific channel
233
- * @param channelNumber - The channel number to monitor
234
- * @param callback - Function to call when audio completes
235
- * @example
236
- * ```typescript
237
- * onAudioComplete(0, (info) => {
238
- * logPlaybackComplete(info.fileName);
239
- * if (info.remainingInQueue === 0) {
240
- * showQueueComplete();
241
- * }
242
- * });
243
- * ```
244
- */
245
- export const onAudioComplete = (channelNumber: number, callback: AudioCompleteCallback): void => {
246
- if (!audioChannels[channelNumber]) {
247
- audioChannels[channelNumber] = {
248
- audioCompleteCallbacks: new Set(),
249
- audioStartCallbacks: new Set(),
250
- progressCallbacks: new Map(),
251
- queue: [],
252
- queueChangeCallbacks: new Set()
253
- };
254
- }
255
-
256
- const channel: ExtendedAudioQueueChannel = audioChannels[channelNumber];
257
- if (!channel.audioCompleteCallbacks) {
258
- channel.audioCompleteCallbacks = new Set();
259
- }
260
-
261
- channel.audioCompleteCallbacks.add(callback);
1
+ /**
2
+ * @fileoverview Audio information and progress tracking functions for the audio-channel-queue package
3
+ */
4
+
5
+ import {
6
+ AudioInfo,
7
+ QueueSnapshot,
8
+ ProgressCallback,
9
+ QueueChangeCallback,
10
+ AudioStartCallback,
11
+ AudioCompleteCallback,
12
+ AudioPauseCallback,
13
+ AudioResumeCallback,
14
+ ExtendedAudioQueueChannel
15
+ } from './types';
16
+ import { getAudioInfoFromElement, createQueueSnapshot } from './utils';
17
+ import { setupProgressTracking, cleanupProgressTracking } from './events';
18
+
19
+ /**
20
+ * Global array to store audio channels with their queues and callback management
21
+ * Each channel maintains its own audio queue and event callback sets
22
+ */
23
+ export const audioChannels: ExtendedAudioQueueChannel[] = [];
24
+
25
+ /**
26
+ * Gets current audio information for a specific channel
27
+ * @param channelNumber - The channel number (defaults to 0)
28
+ * @returns AudioInfo object or null if no audio is playing
29
+ * @example
30
+ * ```typescript
31
+ * const info = getCurrentAudioInfo(0);
32
+ * if (info) {
33
+ * console.log(`Currently playing: ${info.fileName}`);
34
+ * console.log(`Progress: ${(info.progress * 100).toFixed(1)}%`);
35
+ * }
36
+ * ```
37
+ */
38
+ export const getCurrentAudioInfo = (channelNumber: number = 0): AudioInfo | null => {
39
+ const channel: ExtendedAudioQueueChannel = audioChannels[channelNumber];
40
+ if (!channel || channel.queue.length === 0) {
41
+ return null;
42
+ }
43
+
44
+ const currentAudio: HTMLAudioElement = channel.queue[0];
45
+ return getAudioInfoFromElement(currentAudio, channelNumber, audioChannels);
46
+ };
47
+
48
+ /**
49
+ * Gets audio information for all channels
50
+ * @returns Array of AudioInfo objects (null for channels with no audio)
51
+ * @example
52
+ * ```typescript
53
+ * const allInfo = getAllChannelsInfo();
54
+ * allInfo.forEach((info, channel) => {
55
+ * if (info) {
56
+ * console.log(`Channel ${channel}: ${info.fileName}`);
57
+ * }
58
+ * });
59
+ * ```
60
+ */
61
+ export const getAllChannelsInfo = (): (AudioInfo | null)[] => {
62
+ const allChannelsInfo: (AudioInfo | null)[] = [];
63
+
64
+ for (let i = 0; i < audioChannels.length; i++) {
65
+ allChannelsInfo.push(getCurrentAudioInfo(i));
66
+ }
67
+
68
+ return allChannelsInfo;
69
+ };
70
+
71
+ /**
72
+ * Gets a complete snapshot of the queue state for a specific channel
73
+ * @param channelNumber - The channel number
74
+ * @returns QueueSnapshot object or null if channel doesn't exist
75
+ * @example
76
+ * ```typescript
77
+ * const snapshot = getQueueSnapshot(0);
78
+ * if (snapshot) {
79
+ * console.log(`Queue has ${snapshot.totalItems} items`);
80
+ * console.log(`Currently playing: ${snapshot.items[0]?.fileName}`);
81
+ * }
82
+ * ```
83
+ */
84
+ export const getQueueSnapshot = (channelNumber: number): QueueSnapshot | null => {
85
+ return createQueueSnapshot(channelNumber, audioChannels);
86
+ };
87
+
88
+ /**
89
+ * Subscribes to real-time progress updates for a specific channel
90
+ * @param channelNumber - The channel number
91
+ * @param callback - Function to call with audio info updates
92
+ * @example
93
+ * ```typescript
94
+ * onAudioProgress(0, (info) => {
95
+ * updateProgressBar(info.progress);
96
+ * updateTimeDisplay(info.currentTime, info.duration);
97
+ * });
98
+ * ```
99
+ */
100
+ export const onAudioProgress = (channelNumber: number, callback: ProgressCallback): void => {
101
+ if (!audioChannels[channelNumber]) {
102
+ audioChannels[channelNumber] = {
103
+ audioCompleteCallbacks: new Set(),
104
+ audioErrorCallbacks: new Set(),
105
+ audioPauseCallbacks: new Set(),
106
+ audioResumeCallbacks: new Set(),
107
+ audioStartCallbacks: new Set(),
108
+ isPaused: false,
109
+ progressCallbacks: new Map(),
110
+ queue: [],
111
+ queueChangeCallbacks: new Set(),
112
+ volume: 1.0
113
+ };
114
+ }
115
+
116
+ const channel: ExtendedAudioQueueChannel = audioChannels[channelNumber];
117
+ if (!channel.progressCallbacks) {
118
+ channel.progressCallbacks = new Map();
119
+ }
120
+
121
+ // Add callback for current audio if exists
122
+ if (channel.queue.length > 0) {
123
+ const currentAudio: HTMLAudioElement = channel.queue[0];
124
+ if (!channel.progressCallbacks.has(currentAudio)) {
125
+ channel.progressCallbacks.set(currentAudio, new Set());
126
+ }
127
+ channel.progressCallbacks.get(currentAudio)!.add(callback);
128
+
129
+ // Set up tracking if not already done
130
+ setupProgressTracking(currentAudio, channelNumber, audioChannels);
131
+ }
132
+
133
+ // Store callback for future audio elements in this channel
134
+ if (!channel.progressCallbacks.has(null as any)) {
135
+ channel.progressCallbacks.set(null as any, new Set());
136
+ }
137
+ channel.progressCallbacks.get(null as any)!.add(callback);
138
+ };
139
+
140
+ /**
141
+ * Removes progress listeners for a specific channel
142
+ * @param channelNumber - The channel number
143
+ * @example
144
+ * ```typescript
145
+ * offAudioProgress(0); // Stop receiving progress updates for channel 0
146
+ * ```
147
+ */
148
+ export const offAudioProgress = (channelNumber: number): void => {
149
+ const channel: ExtendedAudioQueueChannel = audioChannels[channelNumber];
150
+ if (!channel || !channel.progressCallbacks) return;
151
+
152
+ // Clean up event listeners for current audio if exists
153
+ if (channel.queue.length > 0) {
154
+ const currentAudio: HTMLAudioElement = channel.queue[0];
155
+ cleanupProgressTracking(currentAudio, channelNumber, audioChannels);
156
+ }
157
+
158
+ // Clear all callbacks for this channel
159
+ channel.progressCallbacks.clear();
160
+ };
161
+
162
+ /**
163
+ * Subscribes to queue change events for a specific channel
164
+ * @param channelNumber - The channel number to monitor
165
+ * @param callback - Function to call when queue changes
166
+ * @example
167
+ * ```typescript
168
+ * onQueueChange(0, (snapshot) => {
169
+ * updateQueueDisplay(snapshot.items);
170
+ * updateQueueCount(snapshot.totalItems);
171
+ * });
172
+ * ```
173
+ */
174
+ export const onQueueChange = (channelNumber: number, callback: QueueChangeCallback): void => {
175
+ if (!audioChannels[channelNumber]) {
176
+ audioChannels[channelNumber] = {
177
+ audioCompleteCallbacks: new Set(),
178
+ audioErrorCallbacks: new Set(),
179
+ audioPauseCallbacks: new Set(),
180
+ audioResumeCallbacks: new Set(),
181
+ audioStartCallbacks: new Set(),
182
+ isPaused: false,
183
+ progressCallbacks: new Map(),
184
+ queue: [],
185
+ queueChangeCallbacks: new Set(),
186
+ volume: 1.0
187
+ };
188
+ }
189
+
190
+ const channel: ExtendedAudioQueueChannel = audioChannels[channelNumber];
191
+ if (!channel.queueChangeCallbacks) {
192
+ channel.queueChangeCallbacks = new Set();
193
+ }
194
+
195
+ channel.queueChangeCallbacks.add(callback);
196
+ };
197
+
198
+ /**
199
+ * Removes queue change listeners for a specific channel
200
+ * @param channelNumber - The channel number
201
+ * @example
202
+ * ```typescript
203
+ * offQueueChange(0); // Stop receiving queue change notifications for channel 0
204
+ * ```
205
+ */
206
+ export const offQueueChange = (channelNumber: number): void => {
207
+ const channel: ExtendedAudioQueueChannel = audioChannels[channelNumber];
208
+ if (!channel || !channel.queueChangeCallbacks) return;
209
+
210
+ channel.queueChangeCallbacks.clear();
211
+ };
212
+
213
+ /**
214
+ * Subscribes to audio start events for a specific channel
215
+ * @param channelNumber - The channel number to monitor
216
+ * @param callback - Function to call when audio starts playing
217
+ * @example
218
+ * ```typescript
219
+ * onAudioStart(0, (info) => {
220
+ * showNowPlaying(info.fileName);
221
+ * setTotalDuration(info.duration);
222
+ * });
223
+ * ```
224
+ */
225
+ export const onAudioStart = (channelNumber: number, callback: AudioStartCallback): void => {
226
+ if (!audioChannels[channelNumber]) {
227
+ audioChannels[channelNumber] = {
228
+ audioCompleteCallbacks: new Set(),
229
+ audioErrorCallbacks: new Set(),
230
+ audioPauseCallbacks: new Set(),
231
+ audioResumeCallbacks: new Set(),
232
+ audioStartCallbacks: new Set(),
233
+ isPaused: false,
234
+ progressCallbacks: new Map(),
235
+ queue: [],
236
+ queueChangeCallbacks: new Set(),
237
+ volume: 1.0
238
+ };
239
+ }
240
+
241
+ const channel: ExtendedAudioQueueChannel = audioChannels[channelNumber];
242
+ if (!channel.audioStartCallbacks) {
243
+ channel.audioStartCallbacks = new Set();
244
+ }
245
+
246
+ channel.audioStartCallbacks.add(callback);
247
+ };
248
+
249
+ /**
250
+ * Subscribes to audio complete events for a specific channel
251
+ * @param channelNumber - The channel number to monitor
252
+ * @param callback - Function to call when audio completes
253
+ * @example
254
+ * ```typescript
255
+ * onAudioComplete(0, (info) => {
256
+ * logPlaybackComplete(info.fileName);
257
+ * if (info.remainingInQueue === 0) {
258
+ * showQueueComplete();
259
+ * }
260
+ * });
261
+ * ```
262
+ */
263
+ export const onAudioComplete = (channelNumber: number, callback: AudioCompleteCallback): void => {
264
+ if (!audioChannels[channelNumber]) {
265
+ audioChannels[channelNumber] = {
266
+ audioCompleteCallbacks: new Set(),
267
+ audioErrorCallbacks: new Set(),
268
+ audioPauseCallbacks: new Set(),
269
+ audioResumeCallbacks: new Set(),
270
+ audioStartCallbacks: new Set(),
271
+ isPaused: false,
272
+ progressCallbacks: new Map(),
273
+ queue: [],
274
+ queueChangeCallbacks: new Set(),
275
+ volume: 1.0
276
+ };
277
+ }
278
+
279
+ const channel: ExtendedAudioQueueChannel = audioChannels[channelNumber];
280
+ if (!channel.audioCompleteCallbacks) {
281
+ channel.audioCompleteCallbacks = new Set();
282
+ }
283
+
284
+ channel.audioCompleteCallbacks.add(callback);
285
+ };
286
+
287
+ /**
288
+ * Subscribes to audio pause events for a specific channel
289
+ * @param channelNumber - The channel number to monitor
290
+ * @param callback - Function to call when audio is paused
291
+ * @example
292
+ * ```typescript
293
+ * onAudioPause(0, (channelNumber, info) => {
294
+ * showPauseIndicator();
295
+ * logPauseEvent(info.fileName, info.currentTime);
296
+ * });
297
+ * ```
298
+ */
299
+ export const onAudioPause = (channelNumber: number, callback: AudioPauseCallback): void => {
300
+ if (!audioChannels[channelNumber]) {
301
+ audioChannels[channelNumber] = {
302
+ audioCompleteCallbacks: new Set(),
303
+ audioErrorCallbacks: new Set(),
304
+ audioPauseCallbacks: new Set(),
305
+ audioResumeCallbacks: new Set(),
306
+ audioStartCallbacks: new Set(),
307
+ isPaused: false,
308
+ progressCallbacks: new Map(),
309
+ queue: [],
310
+ queueChangeCallbacks: new Set(),
311
+ volume: 1.0
312
+ };
313
+ }
314
+
315
+ const channel: ExtendedAudioQueueChannel = audioChannels[channelNumber];
316
+ if (!channel.audioPauseCallbacks) {
317
+ channel.audioPauseCallbacks = new Set();
318
+ }
319
+
320
+ channel.audioPauseCallbacks.add(callback);
321
+ };
322
+
323
+ /**
324
+ * Subscribes to audio resume events for a specific channel
325
+ * @param channelNumber - The channel number to monitor
326
+ * @param callback - Function to call when audio is resumed
327
+ * @example
328
+ * ```typescript
329
+ * onAudioResume(0, (channelNumber, info) => {
330
+ * hidePauseIndicator();
331
+ * logResumeEvent(info.fileName, info.currentTime);
332
+ * });
333
+ * ```
334
+ */
335
+ export const onAudioResume = (channelNumber: number, callback: AudioResumeCallback): void => {
336
+ if (!audioChannels[channelNumber]) {
337
+ audioChannels[channelNumber] = {
338
+ audioCompleteCallbacks: new Set(),
339
+ audioErrorCallbacks: new Set(),
340
+ audioPauseCallbacks: new Set(),
341
+ audioResumeCallbacks: new Set(),
342
+ audioStartCallbacks: new Set(),
343
+ isPaused: false,
344
+ progressCallbacks: new Map(),
345
+ queue: [],
346
+ queueChangeCallbacks: new Set(),
347
+ volume: 1.0
348
+ };
349
+ }
350
+
351
+ const channel: ExtendedAudioQueueChannel = audioChannels[channelNumber];
352
+ if (!channel.audioResumeCallbacks) {
353
+ channel.audioResumeCallbacks = new Set();
354
+ }
355
+
356
+ channel.audioResumeCallbacks.add(callback);
357
+ };
358
+
359
+ /**
360
+ * Removes pause event listeners for a specific channel
361
+ * @param channelNumber - The channel number
362
+ * @example
363
+ * ```typescript
364
+ * offAudioPause(0); // Stop receiving pause notifications for channel 0
365
+ * ```
366
+ */
367
+ export const offAudioPause = (channelNumber: number): void => {
368
+ const channel: ExtendedAudioQueueChannel = audioChannels[channelNumber];
369
+ if (!channel || !channel.audioPauseCallbacks) return;
370
+
371
+ channel.audioPauseCallbacks.clear();
372
+ };
373
+
374
+ /**
375
+ * Removes resume event listeners for a specific channel
376
+ * @param channelNumber - The channel number
377
+ * @example
378
+ * ```typescript
379
+ * offAudioResume(0); // Stop receiving resume notifications for channel 0
380
+ * ```
381
+ */
382
+ export const offAudioResume = (channelNumber: number): void => {
383
+ const channel: ExtendedAudioQueueChannel = audioChannels[channelNumber];
384
+ if (!channel || !channel.audioResumeCallbacks) return;
385
+
386
+ channel.audioResumeCallbacks.clear();
262
387
  };