@ikonai/sdk 1.0.6 → 1.0.8
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-kpORDYGU.js → audio-capture-worker-D0tD-mzj.js} +105 -80
- package/assets/{audio-playback-worker-DPybcm1k.js → audio-playback-worker-CM2aCt54.js} +295 -263
- package/assets/{protocol-worker-DIKCgk1A.js → protocol-worker-CH5R2dxZ.js} +116 -93
- package/assets/{video-capture-worker-DP3lFDjq.js → video-capture-worker-DZZ0ggvo.js} +32 -32
- package/assets/{video-playback-worker-qauTQ7Et.js → video-playback-worker-C7sQMgD-.js} +9 -9
- package/client/ikon-client-config.d.ts +0 -14
- package/functions/function-registry.d.ts +32 -1
- package/index.d.ts +4 -3
- package/index.js +1406 -1294
- package/package.json +1 -1
- package/utils/debug-mode.d.ts +14 -0
- package/utils/logger.d.ts +17 -0
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
function B(t, e, r, n, i) {
|
|
2
|
-
const s = i?.trackId ?? 0, a = i?.sequenceId ?? 0,
|
|
3
|
-
|
|
2
|
+
const s = i?.trackId ?? 0, a = i?.sequenceId ?? 0, u = i?.flags ?? 0, c = i?.targetIds ?? [], h = i?.payloadType ?? 8, w = 27 + c.length * 4, I = w + e.length, y = new Uint8Array(I), l = new DataView(y.buffer);
|
|
3
|
+
l.setUint32(0, I, !0), l.setUint32(4, t >>> 0, !0), l.setUint32(8, n >>> 0, !0), l.setUint32(12, s >>> 0, !0), l.setUint32(16, a >>> 0, !0), l.setUint32(20, c.length >>> 0, !0), l.setUint8(24, r & 255), l.setUint8(25, h & 255), l.setUint8(26, u & 255);
|
|
4
4
|
let v = 27;
|
|
5
|
-
for (let
|
|
6
|
-
|
|
5
|
+
for (let D = 0; D < c.length; D++)
|
|
6
|
+
l.setUint32(v, c[D] >>> 0, !0), v += 4;
|
|
7
7
|
return y.set(e, w), y;
|
|
8
8
|
}
|
|
9
9
|
var f = /* @__PURE__ */ ((t) => (t[t.Null = 1] = "Null", t[t.Bool = 2] = "Bool", t[t.Int32 = 3] = "Int32", t[t.Int64 = 4] = "Int64", t[t.UInt32 = 5] = "UInt32", t[t.UInt64 = 6] = "UInt64", t[t.Float32 = 7] = "Float32", t[t.Float64 = 8] = "Float64", t[t.Array = 9] = "Array", t[t.Dict = 10] = "Dict", t[t.Object = 11] = "Object", t[t.String = 12] = "String", t[t.Binary = 13] = "Binary", t[t.Guid = 14] = "Guid", t))(f || {});
|
|
@@ -57,7 +57,7 @@ class E {
|
|
|
57
57
|
this.writeVariableField(e, 11, s);
|
|
58
58
|
}
|
|
59
59
|
writeArrayField(e, r, n) {
|
|
60
|
-
const i = new
|
|
60
|
+
const i = new U(r);
|
|
61
61
|
n(i);
|
|
62
62
|
const s = i.finish();
|
|
63
63
|
this.writeVariableField(e, 9, s);
|
|
@@ -81,7 +81,7 @@ class E {
|
|
|
81
81
|
this.buffer.writeUInt32(e >>> 0), this.buffer.writeByte(F(r)), q(r) && this.buffer.writeVarUInt(n >>> 0);
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
|
-
class
|
|
84
|
+
class U {
|
|
85
85
|
constructor(e) {
|
|
86
86
|
this.elementType = e;
|
|
87
87
|
}
|
|
@@ -168,7 +168,7 @@ class _ {
|
|
|
168
168
|
9
|
|
169
169
|
/* Array */
|
|
170
170
|
), this.count++;
|
|
171
|
-
const n = new
|
|
171
|
+
const n = new U(e);
|
|
172
172
|
r(n);
|
|
173
173
|
const i = n.finish();
|
|
174
174
|
this.payload.writeBytes(i);
|
|
@@ -373,7 +373,7 @@ class j {
|
|
|
373
373
|
9
|
|
374
374
|
/* Array */
|
|
375
375
|
);
|
|
376
|
-
const n = new
|
|
376
|
+
const n = new U(e);
|
|
377
377
|
r(n);
|
|
378
378
|
const i = n.finish();
|
|
379
379
|
this.payload.writeBytes(i), this.valueWritten = !0;
|
|
@@ -416,8 +416,8 @@ class o {
|
|
|
416
416
|
throw new Error("Guid string must be 32 hex characters");
|
|
417
417
|
const n = new Uint8Array(16), i = o.parseHexSlice(r, 0, 8), s = o.parseHexSlice(r, 8, 4), a = o.parseHexSlice(r, 12, 4);
|
|
418
418
|
o.writeUInt32LE(n, 0, i), o.writeUInt16LE(n, 4, s), o.writeUInt16LE(n, 6, a);
|
|
419
|
-
for (let
|
|
420
|
-
n[8 +
|
|
419
|
+
for (let u = 0; u < 8; u++)
|
|
420
|
+
n[8 + u] = o.parseHexSlice(r, 16 + u * 2, 2);
|
|
421
421
|
return new o(n);
|
|
422
422
|
}
|
|
423
423
|
static fromBytes(e) {
|
|
@@ -674,29 +674,52 @@ class We {
|
|
|
674
674
|
}
|
|
675
675
|
}
|
|
676
676
|
let ve = 1;
|
|
677
|
-
|
|
677
|
+
const Ce = /* @__PURE__ */ new Map(), Ne = {
|
|
678
|
+
0: "DEBUG",
|
|
679
|
+
1: "INFO",
|
|
680
|
+
2: "WARN",
|
|
681
|
+
3: "ERROR",
|
|
682
|
+
4: "NONE"
|
|
683
|
+
};
|
|
684
|
+
function ke(t, e) {
|
|
678
685
|
return `[${t}] ${e}`;
|
|
679
686
|
}
|
|
680
687
|
function A(t, e, r, n) {
|
|
681
|
-
|
|
682
|
-
|
|
688
|
+
const i = (/* @__PURE__ */ new Date()).toISOString(), s = Ne[t], a = {
|
|
689
|
+
timestamp: i,
|
|
690
|
+
level: t,
|
|
691
|
+
levelName: s,
|
|
692
|
+
component: e,
|
|
693
|
+
message: r,
|
|
694
|
+
args: n
|
|
695
|
+
};
|
|
696
|
+
for (const [u, c] of Ce) {
|
|
697
|
+
const h = c?.minLevel ?? 2;
|
|
698
|
+
if (t >= h)
|
|
699
|
+
try {
|
|
700
|
+
u(a);
|
|
701
|
+
} catch {
|
|
702
|
+
}
|
|
703
|
+
}
|
|
704
|
+
if (ve <= t) {
|
|
705
|
+
const u = ke(e, r);
|
|
683
706
|
switch (t) {
|
|
684
707
|
case 0:
|
|
685
|
-
console.debug(
|
|
708
|
+
console.debug(u, ...n);
|
|
686
709
|
break;
|
|
687
710
|
case 1:
|
|
688
|
-
console.info(
|
|
711
|
+
console.info(u, ...n);
|
|
689
712
|
break;
|
|
690
713
|
case 2:
|
|
691
|
-
console.warn(
|
|
714
|
+
console.warn(u, ...n);
|
|
692
715
|
break;
|
|
693
716
|
case 3:
|
|
694
|
-
console.error(
|
|
717
|
+
console.error(u, ...n);
|
|
695
718
|
break;
|
|
696
719
|
}
|
|
697
720
|
}
|
|
698
721
|
}
|
|
699
|
-
function
|
|
722
|
+
function xe(t) {
|
|
700
723
|
return {
|
|
701
724
|
debug(e, ...r) {
|
|
702
725
|
A(0, t, e, r);
|
|
@@ -712,8 +735,8 @@ function Ne(t) {
|
|
|
712
735
|
}
|
|
713
736
|
};
|
|
714
737
|
}
|
|
715
|
-
const
|
|
716
|
-
class
|
|
738
|
+
const He = 20, M = 32e3, ze = 5, V = 8e3, _ = xe("AudioCaptureWorker");
|
|
739
|
+
class Ke {
|
|
717
740
|
encoder = null;
|
|
718
741
|
isReady = !1;
|
|
719
742
|
sampleRate;
|
|
@@ -735,7 +758,7 @@ class He {
|
|
|
735
758
|
channels: this.channels,
|
|
736
759
|
bitrate: this.bitrate,
|
|
737
760
|
application: r,
|
|
738
|
-
complexity:
|
|
761
|
+
complexity: ze
|
|
739
762
|
}), await this.encoder.ready, this.isReady = !0;
|
|
740
763
|
} catch (e) {
|
|
741
764
|
this.onError(e instanceof Error ? e : new Error(String(e)));
|
|
@@ -776,16 +799,18 @@ function g(t, e) {
|
|
|
776
799
|
const r = t instanceof Error ? t : new Error(String(t));
|
|
777
800
|
T({ type: "error", captureId: e, error: { name: r.name, message: r.message, stack: r.stack } });
|
|
778
801
|
}
|
|
779
|
-
function
|
|
802
|
+
function $e(t) {
|
|
780
803
|
return t.byteOffset === 0 && t.byteLength === t.buffer.byteLength ? t.buffer : t.slice().buffer;
|
|
781
804
|
}
|
|
782
805
|
function L(t) {
|
|
783
|
-
if (!p)
|
|
806
|
+
if (!p) {
|
|
807
|
+
_.warn("Audio capture message dropped: sendPort not available");
|
|
784
808
|
return;
|
|
785
|
-
|
|
809
|
+
}
|
|
810
|
+
const e = $e(t);
|
|
786
811
|
p.postMessage({ type: "send", message: e }, [e]);
|
|
787
812
|
}
|
|
788
|
-
function
|
|
813
|
+
function je(t) {
|
|
789
814
|
if (t.length === 0)
|
|
790
815
|
return 0;
|
|
791
816
|
let e = 0;
|
|
@@ -793,11 +818,11 @@ function Ke(t) {
|
|
|
793
818
|
e += Math.abs(t[r] ?? 0);
|
|
794
819
|
return e / t.length;
|
|
795
820
|
}
|
|
796
|
-
const
|
|
821
|
+
const d = /* @__PURE__ */ new Map();
|
|
797
822
|
let S = null;
|
|
798
|
-
function
|
|
823
|
+
function qe() {
|
|
799
824
|
S === null && (S = self.setInterval(() => {
|
|
800
|
-
for (const t of
|
|
825
|
+
for (const t of d.values())
|
|
801
826
|
if (!(t.transport !== "sab" || !t.ringBuffer || !t.ringTemp || t.stopped))
|
|
802
827
|
try {
|
|
803
828
|
const e = t.ringBuffer.pop(t.ringTemp);
|
|
@@ -809,11 +834,11 @@ function $e() {
|
|
|
809
834
|
}
|
|
810
835
|
}, 10));
|
|
811
836
|
}
|
|
812
|
-
function
|
|
837
|
+
function Ge() {
|
|
813
838
|
if (S === null)
|
|
814
839
|
return;
|
|
815
840
|
let t = !1;
|
|
816
|
-
for (const e of
|
|
841
|
+
for (const e of d.values())
|
|
817
842
|
if (e.transport === "sab" && !e.stopped) {
|
|
818
843
|
t = !0;
|
|
819
844
|
break;
|
|
@@ -843,7 +868,7 @@ function P(t) {
|
|
|
843
868
|
r.set(t.pendingBuffer.subarray(i, n)), r.set(t.pendingBuffer.subarray(0, e - a), a);
|
|
844
869
|
}
|
|
845
870
|
t.pendingReadOffset = (i + e) % n, t.pendingSamples -= e;
|
|
846
|
-
const s =
|
|
871
|
+
const s = je(r);
|
|
847
872
|
t.lastVolume = s;
|
|
848
873
|
try {
|
|
849
874
|
if (t.useWasmEncoder)
|
|
@@ -873,42 +898,42 @@ function W(t, e) {
|
|
|
873
898
|
return;
|
|
874
899
|
const n = t.pendingSamples + r;
|
|
875
900
|
if (n > t.pendingBuffer.length) {
|
|
876
|
-
const a = Math.max(n, t.pendingBuffer.length * 2),
|
|
901
|
+
const a = Math.max(n, t.pendingBuffer.length * 2), u = new Float32Array(a);
|
|
877
902
|
if (t.pendingSamples > 0) {
|
|
878
|
-
const
|
|
879
|
-
if (t.pendingReadOffset + t.pendingSamples <=
|
|
880
|
-
|
|
903
|
+
const c = t.pendingBuffer.length;
|
|
904
|
+
if (t.pendingReadOffset + t.pendingSamples <= c)
|
|
905
|
+
u.set(t.pendingBuffer.subarray(t.pendingReadOffset, t.pendingReadOffset + t.pendingSamples));
|
|
881
906
|
else {
|
|
882
|
-
const
|
|
883
|
-
|
|
907
|
+
const h = c - t.pendingReadOffset;
|
|
908
|
+
u.set(t.pendingBuffer.subarray(t.pendingReadOffset, c)), u.set(t.pendingBuffer.subarray(0, t.pendingSamples - h), h);
|
|
884
909
|
}
|
|
885
910
|
}
|
|
886
|
-
t.pendingBuffer =
|
|
911
|
+
t.pendingBuffer = u, t.pendingReadOffset = 0, t.pendingWriteOffset = t.pendingSamples;
|
|
887
912
|
}
|
|
888
913
|
const i = t.pendingBuffer.length, s = Math.min(r, i - t.pendingWriteOffset);
|
|
889
914
|
t.pendingBuffer.set(e.subarray(0, s), t.pendingWriteOffset), s < r && t.pendingBuffer.set(e.subarray(s), 0), t.pendingWriteOffset = (t.pendingWriteOffset + r) % i, t.pendingSamples += r, P(t);
|
|
890
915
|
}
|
|
891
916
|
function H(t, e, r, n, i = !0) {
|
|
892
|
-
const s =
|
|
917
|
+
const s = d.get(t.captureId);
|
|
893
918
|
if (!s || s.stopped || !s.inSegment && !s.segmentEndPending)
|
|
894
919
|
return;
|
|
895
920
|
const a = e.byteLength;
|
|
896
921
|
s.encoderOutputBuffer.length < a && (s.encoderOutputBuffer = new Uint8Array(Math.max(a, s.encoderOutputBuffer.length * 2))), s.encoderOutputBuffer.set(e);
|
|
897
|
-
const
|
|
898
|
-
|
|
899
|
-
const
|
|
900
|
-
|
|
922
|
+
const u = s.encoderOutputBuffer.subarray(0, a), c = s.segmentStartPending;
|
|
923
|
+
c && (s.segmentStartPending = !1, s.epoch++, s.sequence = 0);
|
|
924
|
+
const h = s.segmentEndPending;
|
|
925
|
+
h && (s.segmentEndPending = !1, s.inSegment = !1);
|
|
901
926
|
const w = s.frameSize * s.channels, I = BigInt(Math.floor(r / 1e6 * s.sampleRate * s.channels));
|
|
902
927
|
L(
|
|
903
928
|
le(
|
|
904
929
|
ae({
|
|
905
|
-
Samples:
|
|
930
|
+
Samples: u,
|
|
906
931
|
Epoch: s.epoch,
|
|
907
932
|
Sequence: s.sequence,
|
|
908
933
|
FrameSizeInInterleavedSamples: w,
|
|
909
934
|
TimeStampInInterleavedSamples: I,
|
|
910
|
-
IsFirst:
|
|
911
|
-
IsLast:
|
|
935
|
+
IsFirst: c,
|
|
936
|
+
IsLast: h,
|
|
912
937
|
AverageVolume: s.lastVolume,
|
|
913
938
|
AudioEventEstimatedDuration: 0
|
|
914
939
|
}),
|
|
@@ -917,10 +942,10 @@ function H(t, e, r, n, i = !0) {
|
|
|
917
942
|
)
|
|
918
943
|
), s.sequence++;
|
|
919
944
|
}
|
|
920
|
-
function
|
|
945
|
+
function Ye(t) {
|
|
921
946
|
const e = Math.max(V, Math.floor(t.options?.bitrate ?? M)), r = new AudioEncoder({
|
|
922
947
|
output: (n) => {
|
|
923
|
-
const i =
|
|
948
|
+
const i = d.get(t.captureId);
|
|
924
949
|
if (!i)
|
|
925
950
|
return;
|
|
926
951
|
const s = n.byteLength;
|
|
@@ -949,15 +974,15 @@ function qe(t) {
|
|
|
949
974
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
950
975
|
}), r;
|
|
951
976
|
}
|
|
952
|
-
function
|
|
977
|
+
function Je(t) {
|
|
953
978
|
const e = Math.max(V, Math.floor(t.options?.bitrate ?? M));
|
|
954
|
-
return new
|
|
979
|
+
return new Ke({
|
|
955
980
|
sampleRate: t.sampleRate,
|
|
956
981
|
channels: t.channels,
|
|
957
982
|
bitrate: e,
|
|
958
983
|
frameSize: t.frameSize,
|
|
959
984
|
onOutput: (r, n, i) => {
|
|
960
|
-
const s =
|
|
985
|
+
const s = d.get(t.captureId);
|
|
961
986
|
s && H(s, r, n, i, !0);
|
|
962
987
|
},
|
|
963
988
|
onError: (r) => {
|
|
@@ -965,7 +990,7 @@ function Ge(t) {
|
|
|
965
990
|
}
|
|
966
991
|
});
|
|
967
992
|
}
|
|
968
|
-
async function
|
|
993
|
+
async function Ze() {
|
|
969
994
|
if (typeof AudioEncoder > "u")
|
|
970
995
|
return !1;
|
|
971
996
|
try {
|
|
@@ -978,12 +1003,12 @@ async function Ye() {
|
|
|
978
1003
|
return !1;
|
|
979
1004
|
}
|
|
980
1005
|
}
|
|
981
|
-
async function
|
|
1006
|
+
async function Qe(t) {
|
|
982
1007
|
if (!p)
|
|
983
1008
|
throw new Error("Audio capture worker missing send port");
|
|
984
|
-
if (
|
|
1009
|
+
if (d.has(t.captureId))
|
|
985
1010
|
return;
|
|
986
|
-
const e = Math.max(8e3, Math.floor(t.sampleRate)), r = Math.max(1, Math.floor(t.channels)), n = Math.max(1, Math.floor(e *
|
|
1011
|
+
const e = Math.max(8e3, Math.floor(t.sampleRate)), r = Math.max(1, Math.floor(t.channels)), n = Math.max(1, Math.floor(e * He / 1e3)), i = Math.max(1, Math.floor(n * 1e6 / e)), s = n * 4, a = {
|
|
987
1012
|
captureId: t.captureId,
|
|
988
1013
|
senderId: t.senderId,
|
|
989
1014
|
trackId: t.trackId,
|
|
@@ -1010,31 +1035,31 @@ async function Je(t) {
|
|
|
1010
1035
|
sequence: 0,
|
|
1011
1036
|
lastVolume: 0,
|
|
1012
1037
|
options: t.options
|
|
1013
|
-
},
|
|
1014
|
-
let
|
|
1038
|
+
}, c = (t.options?.preferWebCodecs ?? !0) && await Ze();
|
|
1039
|
+
let h, w = !1;
|
|
1015
1040
|
const I = Math.max(V, Math.floor(t.options?.bitrate ?? M));
|
|
1016
|
-
if (
|
|
1017
|
-
|
|
1041
|
+
if (c)
|
|
1042
|
+
h = Ye(a), _.info(
|
|
1018
1043
|
`Audio capture started: encoder=WebCodecs, sampleRate=${e}Hz, channels=${r}, bitrate=${I}bps`
|
|
1019
1044
|
);
|
|
1020
1045
|
else {
|
|
1021
|
-
const
|
|
1022
|
-
await
|
|
1046
|
+
const l = Je(a);
|
|
1047
|
+
await l.initialize(), h = l, w = !0, _.info(
|
|
1023
1048
|
`Audio capture started: encoder=WASM Opus, sampleRate=${e}Hz, channels=${r}, bitrate=${I}bps`
|
|
1024
1049
|
);
|
|
1025
1050
|
}
|
|
1026
1051
|
const y = {
|
|
1027
1052
|
...a,
|
|
1028
|
-
encoder:
|
|
1053
|
+
encoder: h,
|
|
1029
1054
|
useWasmEncoder: w
|
|
1030
1055
|
};
|
|
1031
1056
|
if (t.transport === "sab") {
|
|
1032
1057
|
if (!t.sharedArrayBuffer)
|
|
1033
1058
|
throw new Error("Missing SharedArrayBuffer for sab transport");
|
|
1034
|
-
const
|
|
1035
|
-
y.ringBuffer =
|
|
1059
|
+
const l = new We(t.sharedArrayBuffer, Float32Array);
|
|
1060
|
+
y.ringBuffer = l, y.ringTemp = new Float32Array(Math.max(y.frameSize * 4, 4096)), qe();
|
|
1036
1061
|
}
|
|
1037
|
-
|
|
1062
|
+
d.set(t.captureId, y), L(
|
|
1038
1063
|
Ue(
|
|
1039
1064
|
Ae({
|
|
1040
1065
|
Description: `mic:${t.captureId}`,
|
|
@@ -1049,9 +1074,9 @@ async function Je(t) {
|
|
|
1049
1074
|
), T({ type: "started", captureId: t.captureId, sampleRate: e, channels: r });
|
|
1050
1075
|
}
|
|
1051
1076
|
async function z(t) {
|
|
1052
|
-
const e =
|
|
1077
|
+
const e = d.get(t);
|
|
1053
1078
|
if (e) {
|
|
1054
|
-
e.stopped = !0,
|
|
1079
|
+
e.stopped = !0, d.delete(t);
|
|
1055
1080
|
try {
|
|
1056
1081
|
P(e);
|
|
1057
1082
|
} catch {
|
|
@@ -1064,15 +1089,15 @@ async function z(t) {
|
|
|
1064
1089
|
e.encoder.close();
|
|
1065
1090
|
} catch {
|
|
1066
1091
|
}
|
|
1067
|
-
L(Pe(Te({}), e.senderId, { trackId: e.trackId })), T({ type: "stopped", captureId: t }),
|
|
1092
|
+
L(Pe(Te({}), e.senderId, { trackId: e.trackId })), T({ type: "stopped", captureId: t }), Ge();
|
|
1068
1093
|
}
|
|
1069
1094
|
}
|
|
1070
|
-
function
|
|
1071
|
-
const e =
|
|
1095
|
+
function Xe(t) {
|
|
1096
|
+
const e = d.get(t);
|
|
1072
1097
|
!e || e.stopped || (e.inSegment = !0, e.segmentStartPending = !0);
|
|
1073
1098
|
}
|
|
1074
|
-
function
|
|
1075
|
-
const e =
|
|
1099
|
+
function et(t) {
|
|
1100
|
+
const e = d.get(t);
|
|
1076
1101
|
if (!(!e || e.stopped || !e.inSegment) && (e.segmentEndPending = !0, P(e), e.segmentEndPending && !e.stopped)) {
|
|
1077
1102
|
const r = e.frameSize - e.pendingSamples;
|
|
1078
1103
|
if (r > 0) {
|
|
@@ -1081,8 +1106,8 @@ function Qe(t) {
|
|
|
1081
1106
|
}
|
|
1082
1107
|
}
|
|
1083
1108
|
}
|
|
1084
|
-
function
|
|
1085
|
-
for (const t of Array.from(
|
|
1109
|
+
function tt() {
|
|
1110
|
+
for (const t of Array.from(d.keys()))
|
|
1086
1111
|
z(t);
|
|
1087
1112
|
if (p) {
|
|
1088
1113
|
try {
|
|
@@ -1108,13 +1133,13 @@ self.addEventListener("message", (t) => {
|
|
|
1108
1133
|
return;
|
|
1109
1134
|
}
|
|
1110
1135
|
if (e.type === "start") {
|
|
1111
|
-
|
|
1136
|
+
Qe(e).catch((r) => {
|
|
1112
1137
|
g(r, e.captureId);
|
|
1113
1138
|
});
|
|
1114
1139
|
return;
|
|
1115
1140
|
}
|
|
1116
1141
|
if (e.type === "pcm") {
|
|
1117
|
-
const r =
|
|
1142
|
+
const r = d.get(e.captureId);
|
|
1118
1143
|
if (!r || r.stopped)
|
|
1119
1144
|
return;
|
|
1120
1145
|
W(r, e.pcm);
|
|
@@ -1122,17 +1147,17 @@ self.addEventListener("message", (t) => {
|
|
|
1122
1147
|
}
|
|
1123
1148
|
if (e.type === "stop") {
|
|
1124
1149
|
z(e.captureId).catch((r) => {
|
|
1125
|
-
|
|
1150
|
+
_.warn(`Failed to stop audio capture: ${r}`), g(r, e.captureId);
|
|
1126
1151
|
});
|
|
1127
1152
|
return;
|
|
1128
1153
|
}
|
|
1129
1154
|
if (e.type === "startSegment") {
|
|
1130
|
-
|
|
1155
|
+
Xe(e.captureId);
|
|
1131
1156
|
return;
|
|
1132
1157
|
}
|
|
1133
1158
|
if (e.type === "endSegment") {
|
|
1134
|
-
|
|
1159
|
+
et(e.captureId);
|
|
1135
1160
|
return;
|
|
1136
1161
|
}
|
|
1137
|
-
e.type === "dispose" &&
|
|
1162
|
+
e.type === "dispose" && tt();
|
|
1138
1163
|
});
|