@siteed/expo-audio-stream 1.1.2 → 1.1.5

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.
Files changed (105) hide show
  1. package/build/AudioAnalysis/AudioAnalysis.types.d.ts +74 -0
  2. package/build/AudioAnalysis/AudioAnalysis.types.d.ts.map +1 -0
  3. package/build/AudioAnalysis/AudioAnalysis.types.js +3 -0
  4. package/build/AudioAnalysis/AudioAnalysis.types.js.map +1 -0
  5. package/build/AudioAnalysis/extractAudioAnalysis.d.ts +20 -0
  6. package/build/AudioAnalysis/extractAudioAnalysis.d.ts.map +1 -0
  7. package/build/AudioAnalysis/extractAudioAnalysis.js +88 -0
  8. package/build/AudioAnalysis/extractAudioAnalysis.js.map +1 -0
  9. package/build/AudioAnalysis/extractWaveform.d.ts +8 -0
  10. package/build/AudioAnalysis/extractWaveform.d.ts.map +1 -0
  11. package/build/AudioAnalysis/extractWaveform.js +14 -0
  12. package/build/AudioAnalysis/extractWaveform.js.map +1 -0
  13. package/build/AudioRecorder.provider.d.ts +11 -0
  14. package/build/AudioRecorder.provider.d.ts.map +1 -0
  15. package/build/AudioRecorder.provider.js +36 -0
  16. package/build/AudioRecorder.provider.js.map +1 -0
  17. package/build/ExpoAudioStream.native.d.ts +3 -0
  18. package/build/ExpoAudioStream.native.d.ts.map +1 -0
  19. package/{src/ExpoAudioStream.native.ts → build/ExpoAudioStream.native.js} +3 -3
  20. package/build/ExpoAudioStream.native.js.map +1 -0
  21. package/build/ExpoAudioStream.types.d.ts +76 -0
  22. package/build/ExpoAudioStream.types.d.ts.map +1 -0
  23. package/build/ExpoAudioStream.types.js +2 -0
  24. package/build/ExpoAudioStream.types.js.map +1 -0
  25. package/build/ExpoAudioStream.web.d.ts +42 -0
  26. package/build/ExpoAudioStream.web.d.ts.map +1 -0
  27. package/build/ExpoAudioStream.web.js +203 -0
  28. package/build/ExpoAudioStream.web.js.map +1 -0
  29. package/build/ExpoAudioStreamModule.d.ts +3 -0
  30. package/build/ExpoAudioStreamModule.d.ts.map +1 -0
  31. package/build/ExpoAudioStreamModule.js +25 -0
  32. package/build/ExpoAudioStreamModule.js.map +1 -0
  33. package/build/WebRecorder.web.d.ts +51 -0
  34. package/build/WebRecorder.web.d.ts.map +1 -0
  35. package/build/WebRecorder.web.js +298 -0
  36. package/build/WebRecorder.web.js.map +1 -0
  37. package/build/constants.d.ts +11 -0
  38. package/build/constants.d.ts.map +1 -0
  39. package/build/constants.js +14 -0
  40. package/build/constants.js.map +1 -0
  41. package/build/events.d.ts +18 -0
  42. package/build/events.d.ts.map +1 -0
  43. package/build/events.js +15 -0
  44. package/build/events.js.map +1 -0
  45. package/build/index.d.ts +11 -0
  46. package/build/index.d.ts.map +1 -0
  47. package/build/index.js.map +1 -0
  48. package/build/logger.d.ts +9 -0
  49. package/build/logger.d.ts.map +1 -0
  50. package/build/logger.js +13 -0
  51. package/build/logger.js.map +1 -0
  52. package/build/useAudioRecorder.d.ts +20 -0
  53. package/build/useAudioRecorder.d.ts.map +1 -0
  54. package/build/useAudioRecorder.js +271 -0
  55. package/build/useAudioRecorder.js.map +1 -0
  56. package/build/utils/BlobFix.d.ts +9 -0
  57. package/build/utils/BlobFix.d.ts.map +1 -0
  58. package/{src/utils/BlobFix.ts → build/utils/BlobFix.js} +66 -122
  59. package/build/utils/BlobFix.js.map +1 -0
  60. package/build/utils/concatenateBuffers.d.ts +8 -0
  61. package/build/utils/concatenateBuffers.d.ts.map +1 -0
  62. package/{src/utils/concatenateBuffers.ts → build/utils/concatenateBuffers.js} +10 -13
  63. package/build/utils/concatenateBuffers.js.map +1 -0
  64. package/build/utils/convertPCMToFloat32.d.ts +11 -0
  65. package/build/utils/convertPCMToFloat32.d.ts.map +1 -0
  66. package/build/utils/convertPCMToFloat32.js +54 -0
  67. package/build/utils/convertPCMToFloat32.js.map +1 -0
  68. package/build/utils/encodingToBitDepth.d.ts +5 -0
  69. package/build/utils/encodingToBitDepth.d.ts.map +1 -0
  70. package/build/utils/encodingToBitDepth.js +13 -0
  71. package/build/utils/encodingToBitDepth.js.map +1 -0
  72. package/build/utils/getWavFileInfo.d.ts +26 -0
  73. package/build/utils/getWavFileInfo.d.ts.map +1 -0
  74. package/build/utils/getWavFileInfo.js +92 -0
  75. package/build/utils/getWavFileInfo.js.map +1 -0
  76. package/build/utils/writeWavHeader.d.ts +9 -0
  77. package/build/utils/writeWavHeader.d.ts.map +1 -0
  78. package/build/utils/writeWavHeader.js +45 -0
  79. package/build/utils/writeWavHeader.js.map +1 -0
  80. package/build/workers/InlineFeaturesExtractor.web.d.ts +2 -0
  81. package/build/workers/InlineFeaturesExtractor.web.d.ts.map +1 -0
  82. package/{src/workers/InlineFeaturesExtractor.web.tsx → build/workers/InlineFeaturesExtractor.web.js} +2 -1
  83. package/build/workers/InlineFeaturesExtractor.web.js.map +1 -0
  84. package/build/workers/inlineAudioWebWorker.web.d.ts +2 -0
  85. package/build/workers/inlineAudioWebWorker.web.d.ts.map +1 -0
  86. package/{src/workers/inlineAudioWebWorker.web.tsx → build/workers/inlineAudioWebWorker.web.js} +2 -1
  87. package/build/workers/inlineAudioWebWorker.web.js.map +1 -0
  88. package/package.json +96 -96
  89. package/src/AudioAnalysis/AudioAnalysis.types.ts +0 -84
  90. package/src/AudioAnalysis/extractAudioAnalysis.ts +0 -147
  91. package/src/AudioAnalysis/extractWaveform.ts +0 -25
  92. package/src/AudioRecorder.provider.tsx +0 -70
  93. package/src/ExpoAudioStream.types.ts +0 -80
  94. package/src/ExpoAudioStream.web.ts +0 -255
  95. package/src/ExpoAudioStreamModule.ts +0 -31
  96. package/src/WebRecorder.web.ts +0 -433
  97. package/src/constants.ts +0 -18
  98. package/src/events.ts +0 -39
  99. package/src/index.ts +0 -24
  100. package/src/logger.ts +0 -22
  101. package/src/useAudioRecorder.tsx +0 -420
  102. package/src/utils/convertPCMToFloat32.ts +0 -75
  103. package/src/utils/encodingToBitDepth.ts +0 -18
  104. package/src/utils/getWavFileInfo.ts +0 -132
  105. package/src/utils/writeWavHeader.ts +0 -61
@@ -9,17 +9,7 @@
9
9
  * - Code adapted from: https://github.com/mat-sz/webm-fix-duration
10
10
  * (forked from https://github.com/yusitnikov/fix-webm-duration)
11
11
  */
12
-
13
- /*
14
- * This is the list of possible WEBM file sections by their IDs.
15
- * Possible types: Container, Binary, Uint, Int, String, Float, Date
16
- */
17
- interface Section {
18
- name: string;
19
- type: string;
20
- }
21
-
22
- const sections: Record<number, Section> = {
12
+ const sections = {
23
13
  0xa45dfa3: { name: "EBML", type: "Container" },
24
14
  0x286: { name: "EBMLVersion", type: "Uint" },
25
15
  0x2f7: { name: "EBMLReadVersion", type: "Uint" },
@@ -245,111 +235,92 @@ const sections: Record<number, Section> = {
245
235
  0x487: { name: "TagString", type: "String" },
246
236
  0x485: { name: "TagBinary", type: "Binary" },
247
237
  };
248
-
249
- class WebmBase<T> {
250
- source?: Uint8Array;
251
- data?: T;
252
-
253
- constructor(private name = "Unknown", private type = "Unknown") {}
254
-
255
- updateBySource() {}
256
-
257
- setSource(source: Uint8Array) {
238
+ class WebmBase {
239
+ name;
240
+ type;
241
+ source;
242
+ data;
243
+ constructor(name = "Unknown", type = "Unknown") {
244
+ this.name = name;
245
+ this.type = type;
246
+ }
247
+ updateBySource() { }
248
+ setSource(source) {
258
249
  this.source = source;
259
250
  this.updateBySource();
260
251
  }
261
-
262
- updateByData() {}
263
-
264
- setData(data: T) {
252
+ updateByData() { }
253
+ setData(data) {
265
254
  this.data = data;
266
255
  this.updateByData();
267
256
  }
268
257
  }
269
-
270
- class WebmUint extends WebmBase<string> {
271
- constructor(name: string, type: string) {
258
+ class WebmUint extends WebmBase {
259
+ constructor(name, type) {
272
260
  super(name, type || "Uint");
273
261
  }
274
-
275
262
  updateBySource() {
276
263
  // use hex representation of a number instead of number value
277
264
  this.data = "";
278
- for (let i = 0; i < this.source!.length; i++) {
279
- const hex = this.source![i].toString(16);
265
+ for (let i = 0; i < this.source.length; i++) {
266
+ const hex = this.source[i].toString(16);
280
267
  this.data += padHex(hex);
281
268
  }
282
269
  }
283
-
284
270
  updateByData() {
285
- const length = this.data!.length / 2;
271
+ const length = this.data.length / 2;
286
272
  this.source = new Uint8Array(length);
287
273
  for (let i = 0; i < length; i++) {
288
- const hex = this.data!.substr(i * 2, 2);
274
+ const hex = this.data.substr(i * 2, 2);
289
275
  this.source[i] = parseInt(hex, 16);
290
276
  }
291
277
  }
292
-
293
278
  getValue() {
294
- return parseInt(this.data!, 16);
279
+ return parseInt(this.data, 16);
295
280
  }
296
-
297
- setValue(value: number) {
281
+ setValue(value) {
298
282
  this.setData(padHex(value.toString(16)));
299
283
  }
300
284
  }
301
-
302
- function padHex(hex: string) {
285
+ function padHex(hex) {
303
286
  return hex.length % 2 === 1 ? "0" + hex : hex;
304
287
  }
305
-
306
- class WebmFloat extends WebmBase<number> {
307
- constructor(name: string, type: string) {
288
+ class WebmFloat extends WebmBase {
289
+ constructor(name, type) {
308
290
  super(name, type || "Float");
309
291
  }
310
-
311
292
  getFloatArrayType() {
312
293
  return this.source && this.source.length === 4
313
294
  ? Float32Array
314
295
  : Float64Array;
315
296
  }
316
297
  updateBySource() {
317
- const byteArray = this.source!.reverse();
298
+ const byteArray = this.source.reverse();
318
299
  const floatArrayType = this.getFloatArrayType();
319
300
  const floatArray = new floatArrayType(byteArray.buffer);
320
- this.data! = floatArray[0];
301
+ this.data = floatArray[0];
321
302
  }
322
303
  updateByData() {
323
304
  const floatArrayType = this.getFloatArrayType();
324
- const floatArray = new floatArrayType([this.data!]);
305
+ const floatArray = new floatArrayType([this.data]);
325
306
  const byteArray = new Uint8Array(floatArray.buffer);
326
307
  this.source = byteArray.reverse();
327
308
  }
328
309
  getValue() {
329
310
  return this.data;
330
311
  }
331
- setValue(value: number) {
312
+ setValue(value) {
332
313
  this.setData(value);
333
314
  }
334
315
  }
335
-
336
- interface ContainerData {
337
- id: number;
338
- idHex?: string;
339
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
340
- data: WebmBase<any>;
341
- }
342
-
343
- class WebmContainer extends WebmBase<ContainerData[]> {
344
- offset: number = 0;
345
- data: ContainerData[] = [];
346
-
347
- constructor(name: string, type: string) {
316
+ class WebmContainer extends WebmBase {
317
+ offset = 0;
318
+ data = [];
319
+ constructor(name, type) {
348
320
  super(name, type || "Container");
349
321
  }
350
-
351
322
  readByte() {
352
- return this.source![this.offset++];
323
+ return this.source[this.offset++];
353
324
  }
354
325
  readUint() {
355
326
  const firstByte = this.readByte();
@@ -363,21 +334,16 @@ class WebmContainer extends WebmBase<ContainerData[]> {
363
334
  return value;
364
335
  }
365
336
  updateBySource() {
366
- let end: number | undefined = undefined;
337
+ let end = undefined;
367
338
  this.data = [];
368
- for (
369
- this.offset = 0;
370
- this.offset < this.source!.length;
371
- this.offset = end
372
- ) {
339
+ for (this.offset = 0; this.offset < this.source.length; this.offset = end) {
373
340
  const id = this.readUint();
374
341
  const len = this.readUint();
375
- end = Math.min(this.offset + len, this.source!.length);
376
- const data = this.source!.slice(this.offset, end);
377
-
342
+ end = Math.min(this.offset + len, this.source.length);
343
+ const data = this.source.slice(this.offset, end);
378
344
  const info = sections[id] || { name: "Unknown", type: "Unknown" };
379
345
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
380
- let ctr: any = WebmBase;
346
+ let ctr = WebmBase;
381
347
  switch (info.type) {
382
348
  case "Container":
383
349
  ctr = WebmContainer;
@@ -398,41 +364,35 @@ class WebmContainer extends WebmBase<ContainerData[]> {
398
364
  });
399
365
  }
400
366
  }
401
- writeUint(x: number, draft = false) {
367
+ writeUint(x, draft = false) {
402
368
  let flag = 0x80;
403
369
  let bytes = 1;
404
370
  // eslint-disable-next-line no-empty
405
- for (; x >= flag && bytes < 8; bytes++, flag *= 0x80) {}
406
-
371
+ for (; x >= flag && bytes < 8; bytes++, flag *= 0x80) { }
407
372
  if (!draft) {
408
373
  let value = flag + x;
409
374
  for (let i = bytes - 1; i >= 0; i--) {
410
375
  // don't use bit operators to support x86
411
376
  const c = value % 256;
412
- this.source![this.offset! + i] = c;
377
+ this.source[this.offset + i] = c;
413
378
  value = (value - c) / 256;
414
379
  }
415
380
  }
416
-
417
381
  this.offset += bytes;
418
382
  }
419
-
420
383
  writeSections(draft = false) {
421
384
  this.offset = 0;
422
385
  for (let i = 0; i < this.data.length; i++) {
423
- const section = this.data[i],
424
- content = section.data.source,
425
- contentLength = content!.length;
386
+ const section = this.data[i], content = section.data.source, contentLength = content.length;
426
387
  this.writeUint(section.id, draft);
427
388
  this.writeUint(contentLength, draft);
428
389
  if (!draft) {
429
- this.source!.set(content!, this.offset);
390
+ this.source.set(content, this.offset);
430
391
  }
431
392
  this.offset += contentLength;
432
393
  }
433
394
  return this.offset;
434
395
  }
435
-
436
396
  updateByData() {
437
397
  // run without accessing this.source to determine total length - need to know it to create Uint8Array
438
398
  const length = this.writeSections(true);
@@ -440,53 +400,44 @@ class WebmContainer extends WebmBase<ContainerData[]> {
440
400
  // now really write data
441
401
  this.writeSections();
442
402
  }
443
-
444
- getSectionById(id: number) {
403
+ getSectionById(id) {
445
404
  for (let i = 0; i < this.data.length; i++) {
446
405
  const section = this.data[i];
447
406
  if (section.id === id) {
448
407
  return section.data;
449
408
  }
450
409
  }
451
-
452
410
  return undefined;
453
411
  }
454
412
  }
455
-
456
413
  class WebmFile extends WebmContainer {
457
- constructor(source: Uint8Array) {
414
+ constructor(source) {
458
415
  super("File", "File");
459
416
  this.setSource(source);
460
417
  }
461
-
462
- fixDuration(duration: number) {
463
- const segmentSection = this.getSectionById(0x8538067) as WebmContainer;
418
+ fixDuration(duration) {
419
+ const segmentSection = this.getSectionById(0x8538067);
464
420
  if (!segmentSection) {
465
421
  return false;
466
422
  }
467
-
468
- const infoSection = segmentSection.getSectionById(
469
- 0x549a966,
470
- ) as WebmContainer;
423
+ const infoSection = segmentSection.getSectionById(0x549a966);
471
424
  if (!infoSection) {
472
425
  return false;
473
426
  }
474
-
475
- const timeScaleSection = infoSection.getSectionById(
476
- 0xad7b1,
477
- ) as WebmFloat;
427
+ const timeScaleSection = infoSection.getSectionById(0xad7b1);
478
428
  if (!timeScaleSection) {
479
429
  return false;
480
430
  }
481
-
482
- let durationSection = infoSection.getSectionById(0x489) as WebmFloat;
431
+ let durationSection = infoSection.getSectionById(0x489);
483
432
  if (durationSection) {
484
- if (durationSection.getValue()! <= 0) {
433
+ if (durationSection.getValue() <= 0) {
485
434
  durationSection.setValue(duration);
486
- } else {
435
+ }
436
+ else {
487
437
  return false;
488
438
  }
489
- } else {
439
+ }
440
+ else {
490
441
  // append Duration section
491
442
  durationSection = new WebmFloat("Duration", "Float");
492
443
  durationSection.setValue(duration);
@@ -495,21 +446,17 @@ class WebmFile extends WebmContainer {
495
446
  data: durationSection,
496
447
  });
497
448
  }
498
-
499
449
  // set default time scale to 1 millisecond (1000000 nanoseconds)
500
450
  timeScaleSection.setValue(1000000);
501
451
  infoSection.updateByData();
502
452
  segmentSection.updateByData();
503
453
  this.updateByData();
504
-
505
454
  return true;
506
455
  }
507
-
508
456
  toBlob(type = "video/webm") {
509
- return new Blob([this.source!.buffer], { type });
457
+ return new Blob([this.source.buffer], { type });
510
458
  }
511
459
  }
512
-
513
460
  /**
514
461
  * Fixes duration on MediaRecorder output.
515
462
  * @param blob Input Blob with incorrect duration.
@@ -517,34 +464,31 @@ class WebmFile extends WebmContainer {
517
464
  * @param type Output blob mimetype (default: video/webm).
518
465
  * @returns
519
466
  */
520
- export const webmFixDuration = (
521
- blob: Blob,
522
- duration: number,
523
- type = "video/webm",
524
- ): Promise<Blob> => {
467
+ export const webmFixDuration = (blob, duration, type = "video/webm") => {
525
468
  return new Promise((resolve, reject) => {
526
469
  try {
527
470
  const reader = new FileReader();
528
-
529
471
  reader.addEventListener("loadend", () => {
530
472
  try {
531
- const result = reader.result as ArrayBuffer;
473
+ const result = reader.result;
532
474
  const file = new WebmFile(new Uint8Array(result));
533
475
  if (file.fixDuration(duration)) {
534
476
  resolve(file.toBlob(type));
535
- } else {
477
+ }
478
+ else {
536
479
  resolve(blob);
537
480
  }
538
- } catch (ex) {
481
+ }
482
+ catch (ex) {
539
483
  reject(ex);
540
484
  }
541
485
  });
542
-
543
486
  reader.addEventListener("error", () => reject());
544
-
545
487
  reader.readAsArrayBuffer(blob);
546
- } catch (ex) {
488
+ }
489
+ catch (ex) {
547
490
  reject(ex);
548
491
  }
549
492
  });
550
493
  };
494
+ //# sourceMappingURL=BlobFix.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BlobFix.js","sourceRoot":"","sources":["../../src/utils/BlobFix.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAWH,MAAM,QAAQ,GAA4B;IACtC,SAAS,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,EAAE;IAC9C,KAAK,EAAE,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,EAAE;IAC5C,KAAK,EAAE,EAAE,IAAI,EAAE,iBAAiB,EAAE,IAAI,EAAE,MAAM,EAAE;IAChD,KAAK,EAAE,EAAE,IAAI,EAAE,iBAAiB,EAAE,IAAI,EAAE,MAAM,EAAE;IAChD,KAAK,EAAE,EAAE,IAAI,EAAE,mBAAmB,EAAE,IAAI,EAAE,MAAM,EAAE;IAClD,KAAK,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,QAAQ,EAAE;IAC1C,KAAK,EAAE,EAAE,IAAI,EAAE,gBAAgB,EAAE,IAAI,EAAE,MAAM,EAAE;IAC/C,KAAK,EAAE,EAAE,IAAI,EAAE,oBAAoB,EAAE,IAAI,EAAE,MAAM,EAAE;IACnD,IAAI,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE;IACtC,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE;IACxC,SAAS,EAAE,EAAE,IAAI,EAAE,eAAe,EAAE,IAAI,EAAE,WAAW,EAAE;IACvD,MAAM,EAAE,E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AAC,CAAC,CAAC;oBAClD,IAAI,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,EAAE,CAAC;wBAC7B,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;oBAC/B,CAAC;yBAAM,CAAC;wBACJ,OAAO,CAAC,IAAI,CAAC,CAAC;oBAClB,CAAC;gBACL,CAAC;gBAAC,OAAO,EAAE,EAAE,CAAC;oBACV,MAAM,CAAC,EAAE,CAAC,CAAC;gBACf,CAAC;YACL,CAAC,CAAC,CAAC;YAEH,MAAM,CAAC,gBAAgB,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,MAAM,EAAE,CAAC,CAAC;YAEjD,MAAM,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;QACnC,CAAC;QAAC,OAAO,EAAE,EAAE,CAAC;YACV,MAAM,CAAC,EAAE,CAAC,CAAC;QACf,CAAC;IACL,CAAC,CAAC,CAAC;AACP,CAAC,CAAC","sourcesContent":["/*\n * There is a bug where `navigator.mediaDevices.getUserMedia` + `MediaRecorder`\n * creates WEBM files without duration metadata. See:\n * - https://bugs.chromium.org/p/chromium/issues/detail?id=642012\n * - https://stackoverflow.com/a/39971175/13989043\n *\n * This file contains a function that fixes the duration metadata of a WEBM file.\n * - Answer found: https://stackoverflow.com/a/75218309/13989043\n * - Code adapted from: https://github.com/mat-sz/webm-fix-duration\n * (forked from https://github.com/yusitnikov/fix-webm-duration)\n */\n\n/*\n * This is the list of possible WEBM file sections by their IDs.\n * Possible types: Container, Binary, Uint, Int, String, Float, Date\n */\ninterface Section {\n name: string;\n type: string;\n}\n\nconst sections: Record<number, Section> = {\n 0xa45dfa3: { name: \"EBML\", type: \"Container\" },\n 0x286: { name: \"EBMLVersion\", type: \"Uint\" },\n 0x2f7: { name: \"EBMLReadVersion\", type: \"Uint\" },\n 0x2f2: { name: \"EBMLMaxIDLength\", type: \"Uint\" },\n 0x2f3: { name: \"EBMLMaxSizeLength\", type: \"Uint\" },\n 0x282: { name: \"DocType\", type: \"String\" },\n 0x287: { name: \"DocTypeVersion\", type: \"Uint\" },\n 0x285: { name: \"DocTypeReadVersion\", type: \"Uint\" },\n 0x6c: { name: \"Void\", type: \"Binary\" },\n 0x3f: { name: \"CRC-32\", type: \"Binary\" },\n 0xb538667: { name: \"SignatureSlot\", type: \"Container\" },\n 0x3e8a: { name: \"SignatureAlgo\", type: \"Uint\" },\n 0x3e9a: { name: \"SignatureHash\", type: \"Uint\" },\n 0x3ea5: { name: \"SignaturePublicKey\", type: \"Binary\" },\n 0x3eb5: { name: \"Signature\", type: \"Binary\" },\n 0x3e5b: { name: \"SignatureElements\", type: \"Container\" },\n 0x3e7b: { name: \"SignatureElementList\", type: \"Container\" },\n 0x2532: { name: \"SignedElement\", type: \"Binary\" },\n 0x8538067: { name: \"Segment\", type: \"Container\" },\n 0x14d9b74: { name: \"SeekHead\", type: \"Container\" },\n 0xdbb: { name: \"Seek\", type: \"Container\" },\n 0x13ab: { name: \"SeekID\", type: \"Binary\" },\n 0x13ac: { name: \"SeekPosition\", type: \"Uint\" },\n 0x549a966: { name: \"Info\", type: \"Container\" },\n 0x33a4: { name: \"SegmentUID\", type: \"Binary\" },\n 0x3384: { name: \"SegmentFilename\", type: \"String\" },\n 0x1cb923: { name: \"PrevUID\", type: \"Binary\" },\n 0x1c83ab: { name: \"PrevFilename\", type: \"String\" },\n 0x1eb923: { name: \"NextUID\", type: \"Binary\" },\n 0x1e83bb: { name: \"NextFilename\", type: \"String\" },\n 0x444: { name: \"SegmentFamily\", type: \"Binary\" },\n 0x2924: { name: \"ChapterTranslate\", type: \"Container\" },\n 0x29fc: { name: \"ChapterTranslateEditionUID\", type: \"Uint\" },\n 0x29bf: { name: \"ChapterTranslateCodec\", type: \"Uint\" },\n 0x29a5: { name: \"ChapterTranslateID\", type: \"Binary\" },\n 0xad7b1: { name: \"TimecodeScale\", type: \"Uint\" },\n 0x489: { name: \"Duration\", type: \"Float\" },\n 0x461: { name: \"DateUTC\", type: \"Date\" },\n 0x3ba9: { name: \"Title\", type: \"String\" },\n 0xd80: { name: \"MuxingApp\", type: \"String\" },\n 0x1741: { name: \"WritingApp\", type: \"String\" },\n // 0xf43b675: { name: 'Cluster', type: 'Container' },\n 0x67: { name: \"Timecode\", type: \"Uint\" },\n 0x1854: { name: \"SilentTracks\", type: \"Container\" },\n 0x18d7: { name: \"SilentTrackNumber\", type: \"Uint\" },\n 0x27: { name: \"Position\", type: \"Uint\" },\n 0x2b: { name: \"PrevSize\", type: \"Uint\" },\n 0x23: { name: \"SimpleBlock\", type: \"Binary\" },\n 0x20: { name: \"BlockGroup\", type: \"Container\" },\n 0x21: { name: \"Block\", type: \"Binary\" },\n 0x22: { name: \"BlockVirtual\", type: \"Binary\" },\n 0x35a1: { name: \"BlockAdditions\", type: \"Container\" },\n 0x26: { name: \"BlockMore\", type: \"Container\" },\n 0x6e: { name: \"BlockAddID\", type: \"Uint\" },\n 0x25: { name: \"BlockAdditional\", type: \"Binary\" },\n 0x1b: { name: \"BlockDuration\", type: \"Uint\" },\n 0x7a: { name: \"ReferencePriority\", type: \"Uint\" },\n 0x7b: { name: \"ReferenceBlock\", type: \"Int\" },\n 0x7d: { name: \"ReferenceVirtual\", type: \"Int\" },\n 0x24: { name: \"CodecState\", type: \"Binary\" },\n 0x35a2: { name: \"DiscardPadding\", type: \"Int\" },\n 0xe: { name: \"Slices\", type: \"Container\" },\n 0x68: { name: \"TimeSlice\", type: \"Container\" },\n 0x4c: { name: \"LaceNumber\", type: \"Uint\" },\n 0x4d: { name: \"FrameNumber\", type: \"Uint\" },\n 0x4b: { name: \"BlockAdditionID\", type: \"Uint\" },\n 0x4e: { name: \"Delay\", type: \"Uint\" },\n 0x4f: { name: \"SliceDuration\", type: \"Uint\" },\n 0x48: { name: \"ReferenceFrame\", type: \"Container\" },\n 0x49: { name: \"ReferenceOffset\", type: \"Uint\" },\n 0x4a: { name: \"ReferenceTimeCode\", type: \"Uint\" },\n 0x2f: { name: \"EncryptedBlock\", type: \"Binary\" },\n 0x654ae6b: { name: \"Tracks\", type: \"Container\" },\n 0x2e: { name: \"TrackEntry\", type: \"Container\" },\n 0x57: { name: \"TrackNumber\", type: \"Uint\" },\n 0x33c5: { name: \"TrackUID\", type: \"Uint\" },\n 0x3: { name: \"TrackType\", type: \"Uint\" },\n 0x39: { name: \"FlagEnabled\", type: \"Uint\" },\n 0x8: { name: \"FlagDefault\", type: \"Uint\" },\n 0x15aa: { name: \"FlagForced\", type: \"Uint\" },\n 0x1c: { name: \"FlagLacing\", type: \"Uint\" },\n 0x2de7: { name: \"MinCache\", type: \"Uint\" },\n 0x2df8: { name: \"MaxCache\", type: \"Uint\" },\n 0x3e383: { name: \"DefaultDuration\", type: \"Uint\" },\n 0x34e7a: { name: \"DefaultDecodedFieldDuration\", type: \"Uint\" },\n 0x3314f: { name: \"TrackTimecodeScale\", type: \"Float\" },\n 0x137f: { name: \"TrackOffset\", type: \"Int\" },\n 0x15ee: { name: \"MaxBlockAdditionID\", type: \"Uint\" },\n 0x136e: { name: \"Name\", type: \"String\" },\n 0x2b59c: { name: \"Language\", type: \"String\" },\n 0x6: { name: \"CodecID\", type: \"String\" },\n 0x23a2: { name: \"CodecPrivate\", type: \"Binary\" },\n 0x58688: { name: \"CodecName\", type: \"String\" },\n 0x3446: { name: \"AttachmentLink\", type: \"Uint\" },\n 0x1a9697: { name: \"CodecSettings\", type: \"String\" },\n 0x1b4040: { name: \"CodecInfoURL\", type: \"String\" },\n 0x6b240: { name: \"CodecDownloadURL\", type: \"String\" },\n 0x2a: { name: \"CodecDecodeAll\", type: \"Uint\" },\n 0x2fab: { name: \"TrackOverlay\", type: \"Uint\" },\n 0x16aa: { name: \"CodecDelay\", type: \"Uint\" },\n 0x16bb: { name: \"SeekPreRoll\", type: \"Uint\" },\n 0x2624: { name: \"TrackTranslate\", type: \"Container\" },\n 0x26fc: { name: \"TrackTranslateEditionUID\", type: \"Uint\" },\n 0x26bf: { name: \"TrackTranslateCodec\", type: \"Uint\" },\n 0x26a5: { name: \"TrackTranslateTrackID\", type: \"Binary\" },\n 0x60: { name: \"Video\", type: \"Container\" },\n 0x1a: { name: \"FlagInterlaced\", type: \"Uint\" },\n 0x13b8: { name: \"StereoMode\", type: \"Uint\" },\n 0x13c0: { name: \"AlphaMode\", type: \"Uint\" },\n 0x13b9: { name: \"OldStereoMode\", type: \"Uint\" },\n 0x30: { name: \"PixelWidth\", type: \"Uint\" },\n 0x3a: { name: \"PixelHeight\", type: \"Uint\" },\n 0x14aa: { name: \"PixelCropBottom\", type: \"Uint\" },\n 0x14bb: { name: \"PixelCropTop\", type: \"Uint\" },\n 0x14cc: { name: \"PixelCropLeft\", type: \"Uint\" },\n 0x14dd: { name: \"PixelCropRight\", type: \"Uint\" },\n 0x14b0: { name: \"DisplayWidth\", type: \"Uint\" },\n 0x14ba: { name: \"DisplayHeight\", type: \"Uint\" },\n 0x14b2: { name: \"DisplayUnit\", type: \"Uint\" },\n 0x14b3: { name: \"AspectRatioType\", type: \"Uint\" },\n 0xeb524: { name: \"ColourSpace\", type: \"Binary\" },\n 0xfb523: { name: \"GammaValue\", type: \"Float\" },\n 0x383e3: { name: \"FrameRate\", type: \"Float\" },\n 0x61: { name: \"Audio\", type: \"Container\" },\n 0x35: { name: \"SamplingFrequency\", type: \"Float\" },\n 0x38b5: { name: \"OutputSamplingFrequency\", type: \"Float\" },\n 0x1f: { name: \"Channels\", type: \"Uint\" },\n 0x3d7b: { name: \"ChannelPositions\", type: \"Binary\" },\n 0x2264: { name: \"BitDepth\", type: \"Uint\" },\n 0x62: { name: \"TrackOperation\", type: \"Container\" },\n 0x63: { name: \"TrackCombinePlanes\", type: \"Container\" },\n 0x64: { name: \"TrackPlane\", type: \"Container\" },\n 0x65: { name: \"TrackPlaneUID\", type: \"Uint\" },\n 0x66: { name: \"TrackPlaneType\", type: \"Uint\" },\n 0x69: { name: \"TrackJoinBlocks\", type: \"Container\" },\n 0x6d: { name: \"TrackJoinUID\", type: \"Uint\" },\n 0x40: { name: \"TrickTrackUID\", type: \"Uint\" },\n 0x41: { name: \"TrickTrackSegmentUID\", type: \"Binary\" },\n 0x46: { name: \"TrickTrackFlag\", type: \"Uint\" },\n 0x47: { name: \"TrickMasterTrackUID\", type: \"Uint\" },\n 0x44: { name: \"TrickMasterTrackSegmentUID\", type: \"Binary\" },\n 0x2d80: { name: \"ContentEncodings\", type: \"Container\" },\n 0x2240: { name: \"ContentEncoding\", type: \"Container\" },\n 0x1031: { name: \"ContentEncodingOrder\", type: \"Uint\" },\n 0x1032: { name: \"ContentEncodingScope\", type: \"Uint\" },\n 0x1033: { name: \"ContentEncodingType\", type: \"Uint\" },\n 0x1034: { name: \"ContentCompression\", type: \"Container\" },\n 0x254: { name: \"ContentCompAlgo\", type: \"Uint\" },\n 0x255: { name: \"ContentCompSettings\", type: \"Binary\" },\n 0x1035: { name: \"ContentEncryption\", type: \"Container\" },\n 0x7e1: { name: \"ContentEncAlgo\", type: \"Uint\" },\n 0x7e2: { name: \"ContentEncKeyID\", type: \"Binary\" },\n 0x7e3: { name: \"ContentSignature\", type: \"Binary\" },\n 0x7e4: { name: \"ContentSigKeyID\", type: \"Binary\" },\n 0x7e5: { name: \"ContentSigAlgo\", type: \"Uint\" },\n 0x7e6: { name: \"ContentSigHashAlgo\", type: \"Uint\" },\n 0xc53bb6b: { name: \"Cues\", type: \"Container\" },\n 0x3b: { name: \"CuePoint\", type: \"Container\" },\n 0x33: { name: \"CueTime\", type: \"Uint\" },\n 0x37: { name: \"CueTrackPositions\", type: \"Container\" },\n 0x77: { name: \"CueTrack\", type: \"Uint\" },\n 0x71: { name: \"CueClusterPosition\", type: \"Uint\" },\n 0x70: { name: \"CueRelativePosition\", type: \"Uint\" },\n 0x32: { name: \"CueDuration\", type: \"Uint\" },\n 0x1378: { name: \"CueBlockNumber\", type: \"Uint\" },\n 0x6a: { name: \"CueCodecState\", type: \"Uint\" },\n 0x5b: { name: \"CueReference\", type: \"Container\" },\n 0x16: { name: \"CueRefTime\", type: \"Uint\" },\n 0x17: { name: \"CueRefCluster\", type: \"Uint\" },\n 0x135f: { name: \"CueRefNumber\", type: \"Uint\" },\n 0x6b: { name: \"CueRefCodecState\", type: \"Uint\" },\n 0x941a469: { name: \"Attachments\", type: \"Container\" },\n 0x21a7: { name: \"AttachedFile\", type: \"Container\" },\n 0x67e: { name: \"FileDescription\", type: \"String\" },\n 0x66e: { name: \"FileName\", type: \"String\" },\n 0x660: { name: \"FileMimeType\", type: \"String\" },\n 0x65c: { name: \"FileData\", type: \"Binary\" },\n 0x6ae: { name: \"FileUID\", type: \"Uint\" },\n 0x675: { name: \"FileReferral\", type: \"Binary\" },\n 0x661: { name: \"FileUsedStartTime\", type: \"Uint\" },\n 0x662: { name: \"FileUsedEndTime\", type: \"Uint\" },\n 0x43a770: { name: \"Chapters\", type: \"Container\" },\n 0x5b9: { name: \"EditionEntry\", type: \"Container\" },\n 0x5bc: { name: \"EditionUID\", type: \"Uint\" },\n 0x5bd: { name: \"EditionFlagHidden\", type: \"Uint\" },\n 0x5db: { name: \"EditionFlagDefault\", type: \"Uint\" },\n 0x5dd: { name: \"EditionFlagOrdered\", type: \"Uint\" },\n 0x36: { name: \"ChapterAtom\", type: \"Container\" },\n 0x33c4: { name: \"ChapterUID\", type: \"Uint\" },\n 0x1654: { name: \"ChapterStringUID\", type: \"String\" },\n 0x11: { name: \"ChapterTimeStart\", type: \"Uint\" },\n 0x12: { name: \"ChapterTimeEnd\", type: \"Uint\" },\n 0x18: { name: \"ChapterFlagHidden\", type: \"Uint\" },\n 0x598: { name: \"ChapterFlagEnabled\", type: \"Uint\" },\n 0x2e67: { name: \"ChapterSegmentUID\", type: \"Binary\" },\n 0x2ebc: { name: \"ChapterSegmentEditionUID\", type: \"Uint\" },\n 0x23c3: { name: \"ChapterPhysicalEquiv\", type: \"Uint\" },\n 0xf: { name: \"ChapterTrack\", type: \"Container\" },\n 0x9: { name: \"ChapterTrackNumber\", type: \"Uint\" },\n 0x0: { name: \"ChapterDisplay\", type: \"Container\" },\n 0x5: { name: \"ChapString\", type: \"String\" },\n 0x37c: { name: \"ChapLanguage\", type: \"String\" },\n 0x37e: { name: \"ChapCountry\", type: \"String\" },\n 0x2944: { name: \"ChapProcess\", type: \"Container\" },\n 0x2955: { name: \"ChapProcessCodecID\", type: \"Uint\" },\n 0x50d: { name: \"ChapProcessPrivate\", type: \"Binary\" },\n 0x2911: { name: \"ChapProcessCommand\", type: \"Container\" },\n 0x2922: { name: \"ChapProcessTime\", type: \"Uint\" },\n 0x2933: { name: \"ChapProcessData\", type: \"Binary\" },\n 0x254c367: { name: \"Tags\", type: \"Container\" },\n 0x3373: { name: \"Tag\", type: \"Container\" },\n 0x23c0: { name: \"Targets\", type: \"Container\" },\n 0x28ca: { name: \"TargetTypeValue\", type: \"Uint\" },\n 0x23ca: { name: \"TargetType\", type: \"String\" },\n 0x23c5: { name: \"TagTrackUID\", type: \"Uint\" },\n 0x23c9: { name: \"TagEditionUID\", type: \"Uint\" },\n 0x23c4: { name: \"TagChapterUID\", type: \"Uint\" },\n 0x23c6: { name: \"TagAttachmentUID\", type: \"Uint\" },\n 0x27c8: { name: \"SimpleTag\", type: \"Container\" },\n 0x5a3: { name: \"TagName\", type: \"String\" },\n 0x47a: { name: \"TagLanguage\", type: \"String\" },\n 0x484: { name: \"TagDefault\", type: \"Uint\" },\n 0x487: { name: \"TagString\", type: \"String\" },\n 0x485: { name: \"TagBinary\", type: \"Binary\" },\n};\n\nclass WebmBase<T> {\n source?: Uint8Array;\n data?: T;\n\n constructor(private name = \"Unknown\", private type = \"Unknown\") {}\n\n updateBySource() {}\n\n setSource(source: Uint8Array) {\n this.source = source;\n this.updateBySource();\n }\n\n updateByData() {}\n\n setData(data: T) {\n this.data = data;\n this.updateByData();\n }\n}\n\nclass WebmUint extends WebmBase<string> {\n constructor(name: string, type: string) {\n super(name, type || \"Uint\");\n }\n\n updateBySource() {\n // use hex representation of a number instead of number value\n this.data = \"\";\n for (let i = 0; i < this.source!.length; i++) {\n const hex = this.source![i].toString(16);\n this.data += padHex(hex);\n }\n }\n\n updateByData() {\n const length = this.data!.length / 2;\n this.source = new Uint8Array(length);\n for (let i = 0; i < length; i++) {\n const hex = this.data!.substr(i * 2, 2);\n this.source[i] = parseInt(hex, 16);\n }\n }\n\n getValue() {\n return parseInt(this.data!, 16);\n }\n\n setValue(value: number) {\n this.setData(padHex(value.toString(16)));\n }\n}\n\nfunction padHex(hex: string) {\n return hex.length % 2 === 1 ? \"0\" + hex : hex;\n}\n\nclass WebmFloat extends WebmBase<number> {\n constructor(name: string, type: string) {\n super(name, type || \"Float\");\n }\n\n getFloatArrayType() {\n return this.source && this.source.length === 4\n ? Float32Array\n : Float64Array;\n }\n updateBySource() {\n const byteArray = this.source!.reverse();\n const floatArrayType = this.getFloatArrayType();\n const floatArray = new floatArrayType(byteArray.buffer);\n this.data! = floatArray[0];\n }\n updateByData() {\n const floatArrayType = this.getFloatArrayType();\n const floatArray = new floatArrayType([this.data!]);\n const byteArray = new Uint8Array(floatArray.buffer);\n this.source = byteArray.reverse();\n }\n getValue() {\n return this.data;\n }\n setValue(value: number) {\n this.setData(value);\n }\n}\n\ninterface ContainerData {\n id: number;\n idHex?: string;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n data: WebmBase<any>;\n}\n\nclass WebmContainer extends WebmBase<ContainerData[]> {\n offset: number = 0;\n data: ContainerData[] = [];\n\n constructor(name: string, type: string) {\n super(name, type || \"Container\");\n }\n\n readByte() {\n return this.source![this.offset++];\n }\n readUint() {\n const firstByte = this.readByte();\n const bytes = 8 - firstByte.toString(2).length;\n let value = firstByte - (1 << (7 - bytes));\n for (let i = 0; i < bytes; i++) {\n // don't use bit operators to support x86\n value *= 256;\n value += this.readByte();\n }\n return value;\n }\n updateBySource() {\n let end: number | undefined = undefined;\n this.data = [];\n for (\n this.offset = 0;\n this.offset < this.source!.length;\n this.offset = end\n ) {\n const id = this.readUint();\n const len = this.readUint();\n end = Math.min(this.offset + len, this.source!.length);\n const data = this.source!.slice(this.offset, end);\n\n const info = sections[id] || { name: \"Unknown\", type: \"Unknown\" };\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n let ctr: any = WebmBase;\n switch (info.type) {\n case \"Container\":\n ctr = WebmContainer;\n break;\n case \"Uint\":\n ctr = WebmUint;\n break;\n case \"Float\":\n ctr = WebmFloat;\n break;\n }\n const section = new ctr(info.name, info.type);\n section.setSource(data);\n this.data.push({\n id: id,\n idHex: id.toString(16),\n data: section,\n });\n }\n }\n writeUint(x: number, draft = false) {\n let flag = 0x80;\n let bytes = 1;\n // eslint-disable-next-line no-empty\n for (; x >= flag && bytes < 8; bytes++, flag *= 0x80) {}\n\n if (!draft) {\n let value = flag + x;\n for (let i = bytes - 1; i >= 0; i--) {\n // don't use bit operators to support x86\n const c = value % 256;\n this.source![this.offset! + i] = c;\n value = (value - c) / 256;\n }\n }\n\n this.offset += bytes;\n }\n\n writeSections(draft = false) {\n this.offset = 0;\n for (let i = 0; i < this.data.length; i++) {\n const section = this.data[i],\n content = section.data.source,\n contentLength = content!.length;\n this.writeUint(section.id, draft);\n this.writeUint(contentLength, draft);\n if (!draft) {\n this.source!.set(content!, this.offset);\n }\n this.offset += contentLength;\n }\n return this.offset;\n }\n\n updateByData() {\n // run without accessing this.source to determine total length - need to know it to create Uint8Array\n const length = this.writeSections(true);\n this.source = new Uint8Array(length);\n // now really write data\n this.writeSections();\n }\n\n getSectionById(id: number) {\n for (let i = 0; i < this.data.length; i++) {\n const section = this.data[i];\n if (section.id === id) {\n return section.data;\n }\n }\n\n return undefined;\n }\n}\n\nclass WebmFile extends WebmContainer {\n constructor(source: Uint8Array) {\n super(\"File\", \"File\");\n this.setSource(source);\n }\n\n fixDuration(duration: number) {\n const segmentSection = this.getSectionById(0x8538067) as WebmContainer;\n if (!segmentSection) {\n return false;\n }\n\n const infoSection = segmentSection.getSectionById(\n 0x549a966,\n ) as WebmContainer;\n if (!infoSection) {\n return false;\n }\n\n const timeScaleSection = infoSection.getSectionById(\n 0xad7b1,\n ) as WebmFloat;\n if (!timeScaleSection) {\n return false;\n }\n\n let durationSection = infoSection.getSectionById(0x489) as WebmFloat;\n if (durationSection) {\n if (durationSection.getValue()! <= 0) {\n durationSection.setValue(duration);\n } else {\n return false;\n }\n } else {\n // append Duration section\n durationSection = new WebmFloat(\"Duration\", \"Float\");\n durationSection.setValue(duration);\n infoSection.data.push({\n id: 0x489,\n data: durationSection,\n });\n }\n\n // set default time scale to 1 millisecond (1000000 nanoseconds)\n timeScaleSection.setValue(1000000);\n infoSection.updateByData();\n segmentSection.updateByData();\n this.updateByData();\n\n return true;\n }\n\n toBlob(type = \"video/webm\") {\n return new Blob([this.source!.buffer], { type });\n }\n}\n\n/**\n * Fixes duration on MediaRecorder output.\n * @param blob Input Blob with incorrect duration.\n * @param duration Correct duration (in milliseconds).\n * @param type Output blob mimetype (default: video/webm).\n * @returns\n */\nexport const webmFixDuration = (\n blob: Blob,\n duration: number,\n type = \"video/webm\",\n): Promise<Blob> => {\n return new Promise((resolve, reject) => {\n try {\n const reader = new FileReader();\n\n reader.addEventListener(\"loadend\", () => {\n try {\n const result = reader.result as ArrayBuffer;\n const file = new WebmFile(new Uint8Array(result));\n if (file.fixDuration(duration)) {\n resolve(file.toBlob(type));\n } else {\n resolve(blob);\n }\n } catch (ex) {\n reject(ex);\n }\n });\n\n reader.addEventListener(\"error\", () => reject());\n\n reader.readAsArrayBuffer(blob);\n } catch (ex) {\n reject(ex);\n }\n });\n};\n"]}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Concatenates an array of ArrayBuffers into a single ArrayBuffer.
3
+ *
4
+ * @param buffers - An array of ArrayBuffers to be concatenated.
5
+ * @returns A single ArrayBuffer containing the concatenated data.
6
+ */
7
+ export declare const concatenateBuffers: (buffers: ArrayBuffer[]) => ArrayBuffer;
8
+ //# sourceMappingURL=concatenateBuffers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"concatenateBuffers.d.ts","sourceRoot":"","sources":["../../src/utils/concatenateBuffers.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,YAAa,WAAW,EAAE,KAAG,WAiB3D,CAAA"}
@@ -4,21 +4,18 @@
4
4
  * @param buffers - An array of ArrayBuffers to be concatenated.
5
5
  * @returns A single ArrayBuffer containing the concatenated data.
6
6
  */
7
- export const concatenateBuffers = (buffers: ArrayBuffer[]): ArrayBuffer => {
7
+ export const concatenateBuffers = (buffers) => {
8
8
  // Filter out any undefined or null buffers
9
- const validBuffers = buffers.filter((buffer) => buffer)
10
- const totalLength = validBuffers.reduce(
11
- (sum, buffer) => sum + buffer.byteLength,
12
- 0
13
- )
9
+ const validBuffers = buffers.filter((buffer) => buffer);
10
+ const totalLength = validBuffers.reduce((sum, buffer) => sum + buffer.byteLength, 0);
14
11
  // Create a new Uint8Array to hold the concatenated result
15
- const result = new Uint8Array(totalLength)
12
+ const result = new Uint8Array(totalLength);
16
13
  // Offset to keep track of the current position in the result array
17
- let offset = 0
18
-
14
+ let offset = 0;
19
15
  for (const buffer of validBuffers) {
20
- result.set(new Uint8Array(buffer), offset)
21
- offset += buffer.byteLength
16
+ result.set(new Uint8Array(buffer), offset);
17
+ offset += buffer.byteLength;
22
18
  }
23
- return result.buffer
24
- }
19
+ return result.buffer;
20
+ };
21
+ //# sourceMappingURL=concatenateBuffers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"concatenateBuffers.js","sourceRoot":"","sources":["../../src/utils/concatenateBuffers.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,OAAsB,EAAe,EAAE;IACtE,2CAA2C;IAC3C,MAAM,YAAY,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,CAAA;IACvD,MAAM,WAAW,GAAG,YAAY,CAAC,MAAM,CACnC,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,CAAC,GAAG,GAAG,MAAM,CAAC,UAAU,EACxC,CAAC,CACJ,CAAA;IACD,0DAA0D;IAC1D,MAAM,MAAM,GAAG,IAAI,UAAU,CAAC,WAAW,CAAC,CAAA;IAC1C,mEAAmE;IACnE,IAAI,MAAM,GAAG,CAAC,CAAA;IAEd,KAAK,MAAM,MAAM,IAAI,YAAY,EAAE,CAAC;QAChC,MAAM,CAAC,GAAG,CAAC,IAAI,UAAU,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,CAAA;QAC1C,MAAM,IAAI,MAAM,CAAC,UAAU,CAAA;IAC/B,CAAC;IACD,OAAO,MAAM,CAAC,MAAM,CAAA;AACxB,CAAC,CAAA","sourcesContent":["/**\n * Concatenates an array of ArrayBuffers into a single ArrayBuffer.\n *\n * @param buffers - An array of ArrayBuffers to be concatenated.\n * @returns A single ArrayBuffer containing the concatenated data.\n */\nexport const concatenateBuffers = (buffers: ArrayBuffer[]): ArrayBuffer => {\n // Filter out any undefined or null buffers\n const validBuffers = buffers.filter((buffer) => buffer)\n const totalLength = validBuffers.reduce(\n (sum, buffer) => sum + buffer.byteLength,\n 0\n )\n // Create a new Uint8Array to hold the concatenated result\n const result = new Uint8Array(totalLength)\n // Offset to keep track of the current position in the result array\n let offset = 0\n\n for (const buffer of validBuffers) {\n result.set(new Uint8Array(buffer), offset)\n offset += buffer.byteLength\n }\n return result.buffer\n}\n"]}
@@ -0,0 +1,11 @@
1
+ export declare const WAV_HEADER_SIZE = 44;
2
+ export declare const convertPCMToFloat32: ({ bitDepth, buffer, skipWavHeader, }: {
3
+ buffer: ArrayBuffer;
4
+ bitDepth: number;
5
+ skipWavHeader?: boolean;
6
+ }) => Promise<{
7
+ pcmValues: Float32Array;
8
+ min: number;
9
+ max: number;
10
+ }>;
11
+ //# sourceMappingURL=convertPCMToFloat32.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"convertPCMToFloat32.d.ts","sourceRoot":"","sources":["../../src/utils/convertPCMToFloat32.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,eAAe,KAAK,CAAA;AA8BjC,eAAO,MAAM,mBAAmB,yCAI7B;IACC,MAAM,EAAE,WAAW,CAAA;IACnB,QAAQ,EAAE,MAAM,CAAA;IAChB,aAAa,CAAC,EAAE,OAAO,CAAA;CAC1B,KAAG,OAAO,CAAC;IAAE,SAAS,EAAE,YAAY,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAiChE,CAAA"}
@@ -0,0 +1,54 @@
1
+ import { getWavFileInfo } from './getWavFileInfo';
2
+ import { getLogger } from '../logger';
3
+ export const WAV_HEADER_SIZE = 44;
4
+ const logger = getLogger('convertPCMToFloat32');
5
+ const convertSample = (dataView, offset, bitDepth) => {
6
+ switch (bitDepth) {
7
+ case 8:
8
+ return (dataView.getUint8(offset) - 128) / 128;
9
+ case 16:
10
+ return dataView.getInt16(offset, true) / 32768;
11
+ case 24:
12
+ return (((dataView.getUint8(offset) |
13
+ (dataView.getUint8(offset + 1) << 8) |
14
+ (dataView.getUint8(offset + 2) << 16)) /
15
+ 8388608) *
16
+ 2 -
17
+ 1);
18
+ case 32:
19
+ return dataView.getFloat32(offset, true);
20
+ default:
21
+ throw new Error(`Unsupported bit depth: ${bitDepth}`);
22
+ }
23
+ };
24
+ export const convertPCMToFloat32 = async ({ bitDepth, buffer, skipWavHeader = false, }) => {
25
+ try {
26
+ logger.debug(`Converting PCM to Float32: bitDepth: ${bitDepth}, buffer.byteLength: ${buffer.byteLength}`);
27
+ const dataView = new DataView(buffer);
28
+ let headerOffset = 0;
29
+ if (skipWavHeader) {
30
+ const wavFileInfo = await getWavFileInfo(buffer);
31
+ headerOffset = wavFileInfo.dataChunkOffset;
32
+ }
33
+ const dataLength = buffer.byteLength - headerOffset;
34
+ const sampleLength = Math.floor(dataLength / (bitDepth / 8));
35
+ const float32Array = new Float32Array(sampleLength);
36
+ let min = Infinity;
37
+ let max = -Infinity;
38
+ for (let i = 0; i < sampleLength; i++) {
39
+ const offset = headerOffset + i * (bitDepth / 8);
40
+ const value = convertSample(dataView, offset, bitDepth);
41
+ if (value < min)
42
+ min = value;
43
+ if (value > max)
44
+ max = value;
45
+ float32Array[i] = value;
46
+ }
47
+ return { pcmValues: float32Array, min, max };
48
+ }
49
+ catch (error) {
50
+ logger.error(`Error converting PCM to Float32`, error);
51
+ return { pcmValues: new Float32Array(), min: 0, max: 0 };
52
+ }
53
+ };
54
+ //# sourceMappingURL=convertPCMToFloat32.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"convertPCMToFloat32.js","sourceRoot":"","sources":["../../src/utils/convertPCMToFloat32.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAe,MAAM,kBAAkB,CAAA;AAC9D,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA;AAErC,MAAM,CAAC,MAAM,eAAe,GAAG,EAAE,CAAA;AAEjC,MAAM,MAAM,GAAG,SAAS,CAAC,qBAAqB,CAAC,CAAA;AAE/C,MAAM,aAAa,GAAG,CAClB,QAAkB,EAClB,MAAc,EACd,QAAgB,EACV,EAAE;IACR,QAAQ,QAAQ,EAAE,CAAC;QACf,KAAK,CAAC;YACF,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,GAAG,GAAG,CAAC,GAAG,GAAG,CAAA;QAClD,KAAK,EAAE;YACH,OAAO,QAAQ,CAAC,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC,GAAG,KAAK,CAAA;QAClD,KAAK,EAAE;YACH,OAAO,CACH,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC;gBACvB,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC;gBACpC,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;gBACtC,OAAO,CAAC;gBACR,CAAC;gBAC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A;YAEvD,IAAI,KAAK,GAAG,GAAG;gBAAE,GAAG,GAAG,KAAK,CAAA;YAC5B,IAAI,KAAK,GAAG,GAAG;gBAAE,GAAG,GAAG,KAAK,CAAA;YAE5B,YAAY,CAAC,CAAC,CAAC,GAAG,KAAK,CAAA;QAC3B,CAAC;QAED,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,GAAG,EAAE,GAAG,EAAE,CAAA;IAChD,CAAC;IAAC,OAAO,KAAc,EAAE,CAAC;QACtB,MAAM,CAAC,KAAK,CAAC,iCAAiC,EAAE,KAAK,CAAC,CAAA;QACtD,OAAO,EAAE,SAAS,EAAE,IAAI,YAAY,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,CAAA;IAC5D,CAAC;AACL,CAAC,CAAA","sourcesContent":["import { getWavFileInfo, WavFileInfo } from './getWavFileInfo'\nimport { getLogger } from '../logger'\n\nexport const WAV_HEADER_SIZE = 44\n\nconst logger = getLogger('convertPCMToFloat32')\n\nconst convertSample = (\n dataView: DataView,\n offset: number,\n bitDepth: number\n): number => {\n switch (bitDepth) {\n case 8:\n return (dataView.getUint8(offset) - 128) / 128\n case 16:\n return dataView.getInt16(offset, true) / 32768\n case 24:\n return (\n ((dataView.getUint8(offset) |\n (dataView.getUint8(offset + 1) << 8) |\n (dataView.getUint8(offset + 2) << 16)) /\n 8388608) *\n 2 -\n 1\n )\n case 32:\n return dataView.getFloat32(offset, true)\n default:\n throw new Error(`Unsupported bit depth: ${bitDepth}`)\n }\n}\n\nexport const convertPCMToFloat32 = async ({\n bitDepth,\n buffer,\n skipWavHeader = false,\n}: {\n buffer: ArrayBuffer\n bitDepth: number\n skipWavHeader?: boolean\n}): Promise<{ pcmValues: Float32Array; min: number; max: number }> => {\n try {\n logger.debug(\n `Converting PCM to Float32: bitDepth: ${bitDepth}, buffer.byteLength: ${buffer.byteLength}`\n )\n const dataView = new DataView(buffer)\n let headerOffset = 0\n if (skipWavHeader) {\n const wavFileInfo: WavFileInfo = await getWavFileInfo(buffer)\n headerOffset = wavFileInfo.dataChunkOffset\n }\n\n const dataLength = buffer.byteLength - headerOffset\n const sampleLength = Math.floor(dataLength / (bitDepth / 8))\n const float32Array = new Float32Array(sampleLength)\n let min = Infinity\n let max = -Infinity\n\n for (let i = 0; i < sampleLength; i++) {\n const offset = headerOffset + i * (bitDepth / 8)\n const value = convertSample(dataView, offset, bitDepth)\n\n if (value < min) min = value\n if (value > max) max = value\n\n float32Array[i] = value\n }\n\n return { pcmValues: float32Array, min, max }\n } catch (error: unknown) {\n logger.error(`Error converting PCM to Float32`, error)\n return { pcmValues: new Float32Array(), min: 0, max: 0 }\n }\n}\n"]}
@@ -0,0 +1,5 @@
1
+ import { BitDepth, EncodingType } from '../ExpoAudioStream.types';
2
+ export declare const encodingToBitDepth: ({ encoding, }: {
3
+ encoding: EncodingType;
4
+ }) => BitDepth;
5
+ //# sourceMappingURL=encodingToBitDepth.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"encodingToBitDepth.d.ts","sourceRoot":"","sources":["../../src/utils/encodingToBitDepth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAEjE,eAAO,MAAM,kBAAkB,kBAE5B;IACC,QAAQ,EAAE,YAAY,CAAA;CACzB,KAAG,QAWH,CAAA"}
@@ -0,0 +1,13 @@
1
+ export const encodingToBitDepth = ({ encoding, }) => {
2
+ switch (encoding) {
3
+ case 'pcm_32bit':
4
+ return 32;
5
+ case 'pcm_16bit':
6
+ return 16;
7
+ case 'pcm_8bit':
8
+ return 8;
9
+ default:
10
+ throw new Error(`Unsupported encoding type: ${encoding}`);
11
+ }
12
+ };
13
+ //# sourceMappingURL=encodingToBitDepth.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"encodingToBitDepth.js","sourceRoot":"","sources":["../../src/utils/encodingToBitDepth.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,EAC/B,QAAQ,GAGX,EAAY,EAAE;IACX,QAAQ,QAAQ,EAAE,CAAC;QACf,KAAK,WAAW;YACZ,OAAO,EAAE,CAAA;QACb,KAAK,WAAW;YACZ,OAAO,EAAE,CAAA;QACb,KAAK,UAAU;YACX,OAAO,CAAC,CAAA;QACZ;YACI,MAAM,IAAI,KAAK,CAAC,8BAA8B,QAAQ,EAAE,CAAC,CAAA;IACjE,CAAC;AACL,CAAC,CAAA","sourcesContent":["import { BitDepth, EncodingType } from '../ExpoAudioStream.types'\n\nexport const encodingToBitDepth = ({\n encoding,\n}: {\n encoding: EncodingType\n}): BitDepth => {\n switch (encoding) {\n case 'pcm_32bit':\n return 32\n case 'pcm_16bit':\n return 16\n case 'pcm_8bit':\n return 8\n default:\n throw new Error(`Unsupported encoding type: ${encoding}`)\n }\n}\n"]}