testaugnitorecorder4 1.0.46
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/README.md +179 -0
- package/dist/augnitoRecorder.d.ts +54 -0
- package/dist/augnitoRecorder.js +1601 -0
- package/dist/augnitoRecorder.js.map +1 -0
- package/package.json +44 -0
|
@@ -0,0 +1,1601 @@
|
|
|
1
|
+
function _regeneratorRuntime() {
|
|
2
|
+
_regeneratorRuntime = function () {
|
|
3
|
+
return e;
|
|
4
|
+
};
|
|
5
|
+
var t,
|
|
6
|
+
e = {},
|
|
7
|
+
r = Object.prototype,
|
|
8
|
+
n = r.hasOwnProperty,
|
|
9
|
+
o = Object.defineProperty || function (t, e, r) {
|
|
10
|
+
t[e] = r.value;
|
|
11
|
+
},
|
|
12
|
+
i = "function" == typeof Symbol ? Symbol : {},
|
|
13
|
+
a = i.iterator || "@@iterator",
|
|
14
|
+
c = i.asyncIterator || "@@asyncIterator",
|
|
15
|
+
u = i.toStringTag || "@@toStringTag";
|
|
16
|
+
function define(t, e, r) {
|
|
17
|
+
return Object.defineProperty(t, e, {
|
|
18
|
+
value: r,
|
|
19
|
+
enumerable: !0,
|
|
20
|
+
configurable: !0,
|
|
21
|
+
writable: !0
|
|
22
|
+
}), t[e];
|
|
23
|
+
}
|
|
24
|
+
try {
|
|
25
|
+
define({}, "");
|
|
26
|
+
} catch (t) {
|
|
27
|
+
define = function (t, e, r) {
|
|
28
|
+
return t[e] = r;
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
function wrap(t, e, r, n) {
|
|
32
|
+
var i = e && e.prototype instanceof Generator ? e : Generator,
|
|
33
|
+
a = Object.create(i.prototype),
|
|
34
|
+
c = new Context(n || []);
|
|
35
|
+
return o(a, "_invoke", {
|
|
36
|
+
value: makeInvokeMethod(t, r, c)
|
|
37
|
+
}), a;
|
|
38
|
+
}
|
|
39
|
+
function tryCatch(t, e, r) {
|
|
40
|
+
try {
|
|
41
|
+
return {
|
|
42
|
+
type: "normal",
|
|
43
|
+
arg: t.call(e, r)
|
|
44
|
+
};
|
|
45
|
+
} catch (t) {
|
|
46
|
+
return {
|
|
47
|
+
type: "throw",
|
|
48
|
+
arg: t
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
e.wrap = wrap;
|
|
53
|
+
var h = "suspendedStart",
|
|
54
|
+
l = "suspendedYield",
|
|
55
|
+
f = "executing",
|
|
56
|
+
s = "completed",
|
|
57
|
+
y = {};
|
|
58
|
+
function Generator() {}
|
|
59
|
+
function GeneratorFunction() {}
|
|
60
|
+
function GeneratorFunctionPrototype() {}
|
|
61
|
+
var p = {};
|
|
62
|
+
define(p, a, function () {
|
|
63
|
+
return this;
|
|
64
|
+
});
|
|
65
|
+
var d = Object.getPrototypeOf,
|
|
66
|
+
v = d && d(d(values([])));
|
|
67
|
+
v && v !== r && n.call(v, a) && (p = v);
|
|
68
|
+
var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p);
|
|
69
|
+
function defineIteratorMethods(t) {
|
|
70
|
+
["next", "throw", "return"].forEach(function (e) {
|
|
71
|
+
define(t, e, function (t) {
|
|
72
|
+
return this._invoke(e, t);
|
|
73
|
+
});
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
function AsyncIterator(t, e) {
|
|
77
|
+
function invoke(r, o, i, a) {
|
|
78
|
+
var c = tryCatch(t[r], t, o);
|
|
79
|
+
if ("throw" !== c.type) {
|
|
80
|
+
var u = c.arg,
|
|
81
|
+
h = u.value;
|
|
82
|
+
return h && "object" == typeof h && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) {
|
|
83
|
+
invoke("next", t, i, a);
|
|
84
|
+
}, function (t) {
|
|
85
|
+
invoke("throw", t, i, a);
|
|
86
|
+
}) : e.resolve(h).then(function (t) {
|
|
87
|
+
u.value = t, i(u);
|
|
88
|
+
}, function (t) {
|
|
89
|
+
return invoke("throw", t, i, a);
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
a(c.arg);
|
|
93
|
+
}
|
|
94
|
+
var r;
|
|
95
|
+
o(this, "_invoke", {
|
|
96
|
+
value: function (t, n) {
|
|
97
|
+
function callInvokeWithMethodAndArg() {
|
|
98
|
+
return new e(function (e, r) {
|
|
99
|
+
invoke(t, n, e, r);
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
function makeInvokeMethod(e, r, n) {
|
|
107
|
+
var o = h;
|
|
108
|
+
return function (i, a) {
|
|
109
|
+
if (o === f) throw Error("Generator is already running");
|
|
110
|
+
if (o === s) {
|
|
111
|
+
if ("throw" === i) throw a;
|
|
112
|
+
return {
|
|
113
|
+
value: t,
|
|
114
|
+
done: !0
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
for (n.method = i, n.arg = a;;) {
|
|
118
|
+
var c = n.delegate;
|
|
119
|
+
if (c) {
|
|
120
|
+
var u = maybeInvokeDelegate(c, n);
|
|
121
|
+
if (u) {
|
|
122
|
+
if (u === y) continue;
|
|
123
|
+
return u;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) {
|
|
127
|
+
if (o === h) throw o = s, n.arg;
|
|
128
|
+
n.dispatchException(n.arg);
|
|
129
|
+
} else "return" === n.method && n.abrupt("return", n.arg);
|
|
130
|
+
o = f;
|
|
131
|
+
var p = tryCatch(e, r, n);
|
|
132
|
+
if ("normal" === p.type) {
|
|
133
|
+
if (o = n.done ? s : l, p.arg === y) continue;
|
|
134
|
+
return {
|
|
135
|
+
value: p.arg,
|
|
136
|
+
done: n.done
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
"throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg);
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
function maybeInvokeDelegate(e, r) {
|
|
144
|
+
var n = r.method,
|
|
145
|
+
o = e.iterator[n];
|
|
146
|
+
if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y;
|
|
147
|
+
var i = tryCatch(o, e.iterator, r.arg);
|
|
148
|
+
if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y;
|
|
149
|
+
var a = i.arg;
|
|
150
|
+
return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y);
|
|
151
|
+
}
|
|
152
|
+
function pushTryEntry(t) {
|
|
153
|
+
var e = {
|
|
154
|
+
tryLoc: t[0]
|
|
155
|
+
};
|
|
156
|
+
1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e);
|
|
157
|
+
}
|
|
158
|
+
function resetTryEntry(t) {
|
|
159
|
+
var e = t.completion || {};
|
|
160
|
+
e.type = "normal", delete e.arg, t.completion = e;
|
|
161
|
+
}
|
|
162
|
+
function Context(t) {
|
|
163
|
+
this.tryEntries = [{
|
|
164
|
+
tryLoc: "root"
|
|
165
|
+
}], t.forEach(pushTryEntry, this), this.reset(!0);
|
|
166
|
+
}
|
|
167
|
+
function values(e) {
|
|
168
|
+
if (e || "" === e) {
|
|
169
|
+
var r = e[a];
|
|
170
|
+
if (r) return r.call(e);
|
|
171
|
+
if ("function" == typeof e.next) return e;
|
|
172
|
+
if (!isNaN(e.length)) {
|
|
173
|
+
var o = -1,
|
|
174
|
+
i = function next() {
|
|
175
|
+
for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next;
|
|
176
|
+
return next.value = t, next.done = !0, next;
|
|
177
|
+
};
|
|
178
|
+
return i.next = i;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
throw new TypeError(typeof e + " is not iterable");
|
|
182
|
+
}
|
|
183
|
+
return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", {
|
|
184
|
+
value: GeneratorFunctionPrototype,
|
|
185
|
+
configurable: !0
|
|
186
|
+
}), o(GeneratorFunctionPrototype, "constructor", {
|
|
187
|
+
value: GeneratorFunction,
|
|
188
|
+
configurable: !0
|
|
189
|
+
}), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) {
|
|
190
|
+
var e = "function" == typeof t && t.constructor;
|
|
191
|
+
return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name));
|
|
192
|
+
}, e.mark = function (t) {
|
|
193
|
+
return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t;
|
|
194
|
+
}, e.awrap = function (t) {
|
|
195
|
+
return {
|
|
196
|
+
__await: t
|
|
197
|
+
};
|
|
198
|
+
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () {
|
|
199
|
+
return this;
|
|
200
|
+
}), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) {
|
|
201
|
+
void 0 === i && (i = Promise);
|
|
202
|
+
var a = new AsyncIterator(wrap(t, r, n, o), i);
|
|
203
|
+
return e.isGeneratorFunction(r) ? a : a.next().then(function (t) {
|
|
204
|
+
return t.done ? t.value : a.next();
|
|
205
|
+
});
|
|
206
|
+
}, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () {
|
|
207
|
+
return this;
|
|
208
|
+
}), define(g, "toString", function () {
|
|
209
|
+
return "[object Generator]";
|
|
210
|
+
}), e.keys = function (t) {
|
|
211
|
+
var e = Object(t),
|
|
212
|
+
r = [];
|
|
213
|
+
for (var n in e) r.push(n);
|
|
214
|
+
return r.reverse(), function next() {
|
|
215
|
+
for (; r.length;) {
|
|
216
|
+
var t = r.pop();
|
|
217
|
+
if (t in e) return next.value = t, next.done = !1, next;
|
|
218
|
+
}
|
|
219
|
+
return next.done = !0, next;
|
|
220
|
+
};
|
|
221
|
+
}, e.values = values, Context.prototype = {
|
|
222
|
+
constructor: Context,
|
|
223
|
+
reset: function (e) {
|
|
224
|
+
if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t);
|
|
225
|
+
},
|
|
226
|
+
stop: function () {
|
|
227
|
+
this.done = !0;
|
|
228
|
+
var t = this.tryEntries[0].completion;
|
|
229
|
+
if ("throw" === t.type) throw t.arg;
|
|
230
|
+
return this.rval;
|
|
231
|
+
},
|
|
232
|
+
dispatchException: function (e) {
|
|
233
|
+
if (this.done) throw e;
|
|
234
|
+
var r = this;
|
|
235
|
+
function handle(n, o) {
|
|
236
|
+
return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o;
|
|
237
|
+
}
|
|
238
|
+
for (var o = this.tryEntries.length - 1; o >= 0; --o) {
|
|
239
|
+
var i = this.tryEntries[o],
|
|
240
|
+
a = i.completion;
|
|
241
|
+
if ("root" === i.tryLoc) return handle("end");
|
|
242
|
+
if (i.tryLoc <= this.prev) {
|
|
243
|
+
var c = n.call(i, "catchLoc"),
|
|
244
|
+
u = n.call(i, "finallyLoc");
|
|
245
|
+
if (c && u) {
|
|
246
|
+
if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
|
|
247
|
+
if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
|
|
248
|
+
} else if (c) {
|
|
249
|
+
if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
|
|
250
|
+
} else {
|
|
251
|
+
if (!u) throw Error("try statement without catch or finally");
|
|
252
|
+
if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
},
|
|
257
|
+
abrupt: function (t, e) {
|
|
258
|
+
for (var r = this.tryEntries.length - 1; r >= 0; --r) {
|
|
259
|
+
var o = this.tryEntries[r];
|
|
260
|
+
if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) {
|
|
261
|
+
var i = o;
|
|
262
|
+
break;
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null);
|
|
266
|
+
var a = i ? i.completion : {};
|
|
267
|
+
return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a);
|
|
268
|
+
},
|
|
269
|
+
complete: function (t, e) {
|
|
270
|
+
if ("throw" === t.type) throw t.arg;
|
|
271
|
+
return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y;
|
|
272
|
+
},
|
|
273
|
+
finish: function (t) {
|
|
274
|
+
for (var e = this.tryEntries.length - 1; e >= 0; --e) {
|
|
275
|
+
var r = this.tryEntries[e];
|
|
276
|
+
if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y;
|
|
277
|
+
}
|
|
278
|
+
},
|
|
279
|
+
catch: function (t) {
|
|
280
|
+
for (var e = this.tryEntries.length - 1; e >= 0; --e) {
|
|
281
|
+
var r = this.tryEntries[e];
|
|
282
|
+
if (r.tryLoc === t) {
|
|
283
|
+
var n = r.completion;
|
|
284
|
+
if ("throw" === n.type) {
|
|
285
|
+
var o = n.arg;
|
|
286
|
+
resetTryEntry(r);
|
|
287
|
+
}
|
|
288
|
+
return o;
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
throw Error("illegal catch attempt");
|
|
292
|
+
},
|
|
293
|
+
delegateYield: function (e, r, n) {
|
|
294
|
+
return this.delegate = {
|
|
295
|
+
iterator: values(e),
|
|
296
|
+
resultName: r,
|
|
297
|
+
nextLoc: n
|
|
298
|
+
}, "next" === this.method && (this.arg = t), y;
|
|
299
|
+
}
|
|
300
|
+
}, e;
|
|
301
|
+
}
|
|
302
|
+
function _toPrimitive(t, r) {
|
|
303
|
+
if ("object" != typeof t || !t) return t;
|
|
304
|
+
var e = t[Symbol.toPrimitive];
|
|
305
|
+
if (void 0 !== e) {
|
|
306
|
+
var i = e.call(t, r || "default");
|
|
307
|
+
if ("object" != typeof i) return i;
|
|
308
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
309
|
+
}
|
|
310
|
+
return ("string" === r ? String : Number)(t);
|
|
311
|
+
}
|
|
312
|
+
function _toPropertyKey(t) {
|
|
313
|
+
var i = _toPrimitive(t, "string");
|
|
314
|
+
return "symbol" == typeof i ? i : i + "";
|
|
315
|
+
}
|
|
316
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
317
|
+
try {
|
|
318
|
+
var info = gen[key](arg);
|
|
319
|
+
var value = info.value;
|
|
320
|
+
} catch (error) {
|
|
321
|
+
reject(error);
|
|
322
|
+
return;
|
|
323
|
+
}
|
|
324
|
+
if (info.done) {
|
|
325
|
+
resolve(value);
|
|
326
|
+
} else {
|
|
327
|
+
Promise.resolve(value).then(_next, _throw);
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
function _asyncToGenerator(fn) {
|
|
331
|
+
return function () {
|
|
332
|
+
var self = this,
|
|
333
|
+
args = arguments;
|
|
334
|
+
return new Promise(function (resolve, reject) {
|
|
335
|
+
var gen = fn.apply(self, args);
|
|
336
|
+
function _next(value) {
|
|
337
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
338
|
+
}
|
|
339
|
+
function _throw(err) {
|
|
340
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
341
|
+
}
|
|
342
|
+
_next(undefined);
|
|
343
|
+
});
|
|
344
|
+
};
|
|
345
|
+
}
|
|
346
|
+
function _classCallCheck(instance, Constructor) {
|
|
347
|
+
if (!(instance instanceof Constructor)) {
|
|
348
|
+
throw new TypeError("Cannot call a class as a function");
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
function _defineProperties(target, props) {
|
|
352
|
+
for (var i = 0; i < props.length; i++) {
|
|
353
|
+
var descriptor = props[i];
|
|
354
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
355
|
+
descriptor.configurable = true;
|
|
356
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
357
|
+
Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
function _createClass(Constructor, protoProps, staticProps) {
|
|
361
|
+
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
362
|
+
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
363
|
+
Object.defineProperty(Constructor, "prototype", {
|
|
364
|
+
writable: false
|
|
365
|
+
});
|
|
366
|
+
return Constructor;
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
var LOOP_AUDIO = true;
|
|
370
|
+
var WORKLET_PROCESSOR = "worklet-processor";
|
|
371
|
+
var SAMPLE_RATE = 16000;
|
|
372
|
+
var EOS_MSG = "EOS";
|
|
373
|
+
var DONE_MSG = "DONE";
|
|
374
|
+
var PAUSE_MSG = "PAUSE";
|
|
375
|
+
var PAUSE_SOCKET_MSG = "PAUSESOCKET";
|
|
376
|
+
var RESUME_SOCKET_MSG = "RESUMESOCKET";
|
|
377
|
+
var STOP_MSG = "STOP";
|
|
378
|
+
var CLOSE_MSG = "CLOSE";
|
|
379
|
+
var CHANNEL_COUNT = 1;
|
|
380
|
+
var BITS_PER_SAMPLE = 16;
|
|
381
|
+
var NOISE_SUPPRESS_ENABLED = false;
|
|
382
|
+
var KEEP_ALIVE_TIMEOUT = 120000;
|
|
383
|
+
var IDLE_THREAD_INTERVAL = 10000;
|
|
384
|
+
var CONSUME_INTERVAL = 100;
|
|
385
|
+
var CONNECT_RETRY_TIMEOUT = 10000;
|
|
386
|
+
var HEALTHCHECK_INTERVAL = 1000;
|
|
387
|
+
var SOCKET_TIMEOUT = 10000;
|
|
388
|
+
var MAX_AUDIO_SAMPLES = 16000 * 60 * 30;
|
|
389
|
+
|
|
390
|
+
var Executor = /*#__PURE__*/function () {
|
|
391
|
+
function Executor(enableLogs, eosMessage, socketTimeoutInterval, shouldSendAudioDataSequence, onFinalResult, onPartialResult, onError, onSessionEvent, onOtherResults, onSpeechResponse, bufferSizeInterval, switchToRegularSpeechProfile) {
|
|
392
|
+
_classCallCheck(this, Executor);
|
|
393
|
+
this.worker;
|
|
394
|
+
this.onFinalResultCallback = onFinalResult;
|
|
395
|
+
this.onErrorCallback = onError;
|
|
396
|
+
this.onPartialResultCallback = onPartialResult;
|
|
397
|
+
this.onSessionEventCallback = onSessionEvent;
|
|
398
|
+
this.onOtherResultsCallback = onOtherResults;
|
|
399
|
+
this.onSpeechResponseCallback = onSpeechResponse;
|
|
400
|
+
this.packetSeqId = 0;
|
|
401
|
+
this.audioDuration = 0;
|
|
402
|
+
this.shouldSendAudioDataSequence = shouldSendAudioDataSequence;
|
|
403
|
+
this.heavyOp;
|
|
404
|
+
this.idleLoop;
|
|
405
|
+
this.lastSent;
|
|
406
|
+
this.enableLogs = enableLogs;
|
|
407
|
+
this.eosMessage = eosMessage ? eosMessage : EOS_MSG;
|
|
408
|
+
this.socketTimeoutInterval = socketTimeoutInterval ? socketTimeoutInterval : SOCKET_TIMEOUT;
|
|
409
|
+
this.bufferSizeInterval = bufferSizeInterval;
|
|
410
|
+
this.switchToRegularSpeech = switchToRegularSpeechProfile;
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
// main-thread
|
|
414
|
+
return _createClass(Executor, [{
|
|
415
|
+
key: "Start",
|
|
416
|
+
value: function Start(duration, wsUrl) {
|
|
417
|
+
var _this = this;
|
|
418
|
+
this.audioDuration = duration;
|
|
419
|
+
var workerScript = "\n (() => {\n (".concat(WorkerBlob.toString(), ")(").concat(JSON.stringify(DONE_MSG), ", ").concat(JSON.stringify(this.eosMessage), ", ").concat(JSON.stringify(CLOSE_MSG), ", ").concat(JSON.stringify(CONNECT_RETRY_TIMEOUT), ", ").concat(JSON.stringify(this.socketTimeoutInterval), ", ").concat(JSON.stringify(HEALTHCHECK_INTERVAL), ", ").concat(JSON.stringify(CONSUME_INTERVAL), ", ").concat(JSON.stringify(wsUrl), ", ").concat(JSON.stringify(this.enableLogs), ", ").concat(JSON.stringify(this.shouldSendAudioDataSequence), ",").concat(JSON.stringify(PAUSE_SOCKET_MSG), ", ").concat(JSON.stringify(RESUME_SOCKET_MSG), ", ").concat(JSON.stringify(this.switchToRegularSpeech), ", ").concat(JSON.stringify(this.heavyOp), ");\n })();\n");
|
|
420
|
+
this.worker = new Worker(URL.createObjectURL(new Blob([workerScript], {
|
|
421
|
+
type: "application/javascript"
|
|
422
|
+
})));
|
|
423
|
+
// message received from web-worker
|
|
424
|
+
this.worker.onmessage = function (event) {
|
|
425
|
+
if (_this.enableLogs) {
|
|
426
|
+
console.log("Augnito [MAIN]: " + JSON.stringify(event.data));
|
|
427
|
+
}
|
|
428
|
+
var eventData = event.data;
|
|
429
|
+
// const asrText = document.getElementById("asrText");
|
|
430
|
+
if (eventData.type == "final") _this.onFinalResultCallback(eventData.data);else if (eventData.type == "partial") _this.onPartialResultCallback(eventData.data);else if (eventData.type == "meta") _this.onSessionEventCallback(eventData.data);else if (eventData.type == "error") _this.onErrorCallback(eventData.data);else if (eventData.type == "other") _this.onOtherResultsCallback(eventData.data);else if (eventData.type == "speechResponse") _this.onSpeechResponseCallback(eventData.data);
|
|
431
|
+
};
|
|
432
|
+
// main-thread
|
|
433
|
+
this.idleLoop = setInterval(function () {
|
|
434
|
+
var currentTime = +new Date();
|
|
435
|
+
if (_this.lastSent && currentTime - _this.lastSent > KEEP_ALIVE_TIMEOUT) {
|
|
436
|
+
_this.Send(_this.eosMessage);
|
|
437
|
+
if (_this.enableLogs) {
|
|
438
|
+
console.warn("No data sent since more than ".concat(KEEP_ALIVE_TIMEOUT / 1000, " secs, closing time..."));
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
}, IDLE_THREAD_INTERVAL);
|
|
442
|
+
}
|
|
443
|
+
}, {
|
|
444
|
+
key: "createAudioPacketHeader",
|
|
445
|
+
value: function createAudioPacketHeader(isLastPacket) {
|
|
446
|
+
if (this.audioDuration > 0) {
|
|
447
|
+
this.packetSeqId = Math.ceil(this.audioDuration / this.bufferSizeInterval) + 2;
|
|
448
|
+
this.audioDuration = 0;
|
|
449
|
+
}
|
|
450
|
+
this.packetSeqId++;
|
|
451
|
+
var headerSize = 16;
|
|
452
|
+
|
|
453
|
+
// Create a buffer of the required size
|
|
454
|
+
var buffer = new ArrayBuffer(headerSize);
|
|
455
|
+
var view = new DataView(buffer);
|
|
456
|
+
|
|
457
|
+
// Write '@BSR' as string
|
|
458
|
+
for (var i = 0; i < 4; i++) {
|
|
459
|
+
view.setUint8(i, "@BSR".charCodeAt(i));
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
// Write packet ID (int64)
|
|
463
|
+
view.setBigInt64(4, BigInt(this.packetSeqId), false); // false for big endian
|
|
464
|
+
|
|
465
|
+
// Write boolean value
|
|
466
|
+
view.setUint8(12, isLastPacket ? 1 : 0);
|
|
467
|
+
return buffer;
|
|
468
|
+
}
|
|
469
|
+
}, {
|
|
470
|
+
key: "appendAudioData",
|
|
471
|
+
value: function appendAudioData(arrayBuffer, audioDataBytes) {
|
|
472
|
+
var totalLength = arrayBuffer.byteLength + audioDataBytes.byteLength;
|
|
473
|
+
var combinedBuffer = new ArrayBuffer(totalLength);
|
|
474
|
+
var combinedArray = new Uint8Array(combinedBuffer);
|
|
475
|
+
combinedArray.set(new Uint8Array(arrayBuffer), 0);
|
|
476
|
+
combinedArray.set(new Uint8Array(audioDataBytes), arrayBuffer.byteLength);
|
|
477
|
+
return combinedBuffer;
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
// main-thread
|
|
481
|
+
}, {
|
|
482
|
+
key: "Send",
|
|
483
|
+
value: function Send(data) {
|
|
484
|
+
this.lastSent = +new Date();
|
|
485
|
+
if (data === CLOSE_MSG) {
|
|
486
|
+
var _this$worker;
|
|
487
|
+
(_this$worker = this.worker) === null || _this$worker === void 0 || _this$worker.postMessage(CLOSE_MSG);
|
|
488
|
+
clearInterval(this.idleLoop);
|
|
489
|
+
} else if (data === DONE_MSG) {
|
|
490
|
+
// message sent to web-worker
|
|
491
|
+
if (this.shouldSendAudioDataSequence) {
|
|
492
|
+
var _this$worker2;
|
|
493
|
+
var binaryHeader = this.createAudioPacketHeader(true);
|
|
494
|
+
(_this$worker2 = this.worker) === null || _this$worker2 === void 0 || _this$worker2.postMessage(binaryHeader);
|
|
495
|
+
} else {
|
|
496
|
+
var _this$worker3;
|
|
497
|
+
(_this$worker3 = this.worker) === null || _this$worker3 === void 0 || _this$worker3.postMessage(DONE_MSG);
|
|
498
|
+
}
|
|
499
|
+
clearInterval(this.idleLoop);
|
|
500
|
+
} else if (data == PAUSE_SOCKET_MSG) {
|
|
501
|
+
var _this$worker4;
|
|
502
|
+
(_this$worker4 = this.worker) === null || _this$worker4 === void 0 || _this$worker4.postMessage(PAUSE_SOCKET_MSG);
|
|
503
|
+
} else if (data == RESUME_SOCKET_MSG) {
|
|
504
|
+
var _this$worker5;
|
|
505
|
+
(_this$worker5 = this.worker) === null || _this$worker5 === void 0 || _this$worker5.postMessage(RESUME_SOCKET_MSG);
|
|
506
|
+
} else if (data === this.eosMessage) {
|
|
507
|
+
var _this$worker6;
|
|
508
|
+
if (!this.shouldSendAudioDataSequence) (_this$worker6 = this.worker) === null || _this$worker6 === void 0 || _this$worker6.postMessage(data);
|
|
509
|
+
} else {
|
|
510
|
+
var audioData = [];
|
|
511
|
+
if (this.shouldSendAudioDataSequence) {
|
|
512
|
+
var binaryHeader = this.createAudioPacketHeader(false);
|
|
513
|
+
audioData = this.appendAudioData(binaryHeader, data);
|
|
514
|
+
} else {
|
|
515
|
+
audioData = data;
|
|
516
|
+
}
|
|
517
|
+
if (audioData !== undefined) {
|
|
518
|
+
var _this$worker7;
|
|
519
|
+
// message sent to web-worker - transferrable
|
|
520
|
+
(_this$worker7 = this.worker) === null || _this$worker7 === void 0 || _this$worker7.postMessage(audioData, [audioData]);
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
}, {
|
|
525
|
+
key: "HeavyOp",
|
|
526
|
+
set: function set(heavyOp) {
|
|
527
|
+
this.heavyOp = heavyOp;
|
|
528
|
+
}
|
|
529
|
+
}]);
|
|
530
|
+
}();
|
|
531
|
+
function WorkerBlob(doneMessage, eosMessage, closeMessage, connectionRetryTimeout, socketTimeoutInterval, healthcheckInterval, consumeInterval, wsUrl, enableLogs, shouldSendAudioDataSequence, pauseSocketMessage, resumeSocketMessage, switchToRegularSpeechProfile, heavyOp) {
|
|
532
|
+
var lastConnect;
|
|
533
|
+
var lastDataSent;
|
|
534
|
+
var lastDataReceived;
|
|
535
|
+
var lastPingReceived;
|
|
536
|
+
var queue = [];
|
|
537
|
+
var pauseStateAudio;
|
|
538
|
+
var sentPacketsQueue = [];
|
|
539
|
+
var ws;
|
|
540
|
+
var isDone = false;
|
|
541
|
+
var consumer;
|
|
542
|
+
var healthCheck;
|
|
543
|
+
var retrySentPacket = false;
|
|
544
|
+
var packetId = 0;
|
|
545
|
+
var shouldNotReconnect = false;
|
|
546
|
+
var JobID = "";
|
|
547
|
+
var shouldPauseSocket = false;
|
|
548
|
+
function initConnect() {
|
|
549
|
+
lastConnect = +new Date();
|
|
550
|
+
if (JobID != "") {
|
|
551
|
+
ws = new WebSocket(wsUrl + "&jobid=" + JobID);
|
|
552
|
+
} else {
|
|
553
|
+
ws = new WebSocket(wsUrl);
|
|
554
|
+
}
|
|
555
|
+
ws.onopen = function (event) {
|
|
556
|
+
if (enableLogs) {
|
|
557
|
+
console.log("Augnito: WebSocket connection established - " + JSON.stringify(event));
|
|
558
|
+
}
|
|
559
|
+
if (sentPacketsQueue.length > 0) {
|
|
560
|
+
retrySentPacket = true;
|
|
561
|
+
}
|
|
562
|
+
};
|
|
563
|
+
ws.onmessage = function (message) {
|
|
564
|
+
if (enableLogs) {
|
|
565
|
+
console.log("Augnito: Message from server - " + JSON.stringify(message.data));
|
|
566
|
+
}
|
|
567
|
+
lastDataReceived = +new Date();
|
|
568
|
+
operate(message);
|
|
569
|
+
};
|
|
570
|
+
ws.onerror = function (error) {
|
|
571
|
+
console.error("WebSocket error: ", error);
|
|
572
|
+
self.postMessage({
|
|
573
|
+
type: "error",
|
|
574
|
+
data: JSON.stringify(error)
|
|
575
|
+
});
|
|
576
|
+
// TODO may want to reinitialise
|
|
577
|
+
};
|
|
578
|
+
ws.onclose = function (event) {
|
|
579
|
+
if (enableLogs) {
|
|
580
|
+
console.log("Augnito: WebSocket connection closed - " + JSON.stringify(event));
|
|
581
|
+
}
|
|
582
|
+
cleanup();
|
|
583
|
+
};
|
|
584
|
+
lastDataSent = +new Date();
|
|
585
|
+
lastDataReceived = lastDataSent;
|
|
586
|
+
lastPingReceived = +new Date();
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
// TODO lose the interval and try reading from queue on-add and on-open.
|
|
590
|
+
|
|
591
|
+
function send(data) {
|
|
592
|
+
if (ws && ws.readyState === WebSocket.OPEN) {
|
|
593
|
+
ws.send(data);
|
|
594
|
+
// This needs to be done to keep the "lastDataReceived" value closer to the
|
|
595
|
+
// first "lastDataSent" value after ASR is received from the server, so as to
|
|
596
|
+
// not invoke the healthcheck loop and force close the connection.
|
|
597
|
+
var currentTime = +new Date();
|
|
598
|
+
if (lastDataSent <= lastDataReceived) {
|
|
599
|
+
lastDataReceived = currentTime - 1;
|
|
600
|
+
}
|
|
601
|
+
lastDataSent = currentTime;
|
|
602
|
+
return true;
|
|
603
|
+
} else {
|
|
604
|
+
if (data === eosMessage) {
|
|
605
|
+
if (enableLogs) {
|
|
606
|
+
console.warn("Gulping ".concat(eosMessage, " as socket seems already closed..."));
|
|
607
|
+
}
|
|
608
|
+
cleanup();
|
|
609
|
+
return true;
|
|
610
|
+
}
|
|
611
|
+
if (+new Date() - lastConnect > connectionRetryTimeout && !shouldNotReconnect) {
|
|
612
|
+
initConnect();
|
|
613
|
+
}
|
|
614
|
+
return false;
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
function add(data) {
|
|
618
|
+
queue.push(data);
|
|
619
|
+
}
|
|
620
|
+
function operate(message) {
|
|
621
|
+
try {
|
|
622
|
+
if (message.data === "PING") {
|
|
623
|
+
lastPingReceived = +new Date();
|
|
624
|
+
self.postMessage({
|
|
625
|
+
type: "ping",
|
|
626
|
+
data: message.data
|
|
627
|
+
});
|
|
628
|
+
} else {
|
|
629
|
+
var data = JSON.parse(message.data);
|
|
630
|
+
if (enableLogs) {
|
|
631
|
+
console.log("Augnito [WORKER]: " + JSON.stringify(data));
|
|
632
|
+
}
|
|
633
|
+
if (data.Type == "meta") {
|
|
634
|
+
if (data.JobID) {
|
|
635
|
+
JobID = data.JobID;
|
|
636
|
+
console.log("Augnito JobID:", JobID);
|
|
637
|
+
}
|
|
638
|
+
self.postMessage({
|
|
639
|
+
type: "meta",
|
|
640
|
+
data: message.data
|
|
641
|
+
});
|
|
642
|
+
var metaResponse = JSON.parse(message.data);
|
|
643
|
+
if (metaResponse.Event && metaResponse.Event["Type"] === "INVALID_AUTH_CREDENTIALS") {
|
|
644
|
+
shouldNotReconnect = true;
|
|
645
|
+
} else {
|
|
646
|
+
shouldNotReconnect = false;
|
|
647
|
+
}
|
|
648
|
+
} else if (data.Result && data.Result.Final) {
|
|
649
|
+
// should not be called with "this", check worker construction for more info.
|
|
650
|
+
var outputText = JSON.stringify(data.Result);
|
|
651
|
+
if (heavyOp) {
|
|
652
|
+
outputText = heavyOp(JSON.stringify(data.Result));
|
|
653
|
+
console.log(outputText);
|
|
654
|
+
}
|
|
655
|
+
self.postMessage({
|
|
656
|
+
type: "final",
|
|
657
|
+
data: outputText
|
|
658
|
+
});
|
|
659
|
+
|
|
660
|
+
// message sent to main-thread
|
|
661
|
+
} else if (data.Result && !data.Result.Final) {
|
|
662
|
+
self.postMessage({
|
|
663
|
+
type: "partial",
|
|
664
|
+
data: data.Result.Transcript
|
|
665
|
+
});
|
|
666
|
+
} else if (data.Type == "ACK") {
|
|
667
|
+
//reset queue with only those packets whose seq num is greater than ACK index
|
|
668
|
+
sentPacketsQueue = sentPacketsQueue.filter(function (x) {
|
|
669
|
+
return x.packetNumber > data.Index;
|
|
670
|
+
});
|
|
671
|
+
self.postMessage({
|
|
672
|
+
type: "other",
|
|
673
|
+
data: message.data
|
|
674
|
+
});
|
|
675
|
+
} else if (data.Type == "ERROR") {
|
|
676
|
+
if (data.Data == "Timeout exceeded") {
|
|
677
|
+
isDone = true;
|
|
678
|
+
cleanup();
|
|
679
|
+
}
|
|
680
|
+
self.postMessage({
|
|
681
|
+
type: "error",
|
|
682
|
+
data: message.data
|
|
683
|
+
});
|
|
684
|
+
} else {
|
|
685
|
+
self.postMessage({
|
|
686
|
+
type: "speechResponse",
|
|
687
|
+
data: message.data
|
|
688
|
+
});
|
|
689
|
+
}
|
|
690
|
+
}
|
|
691
|
+
} catch (e) {
|
|
692
|
+
self.postMessage({
|
|
693
|
+
type: "error",
|
|
694
|
+
data: "invalid response"
|
|
695
|
+
});
|
|
696
|
+
}
|
|
697
|
+
}
|
|
698
|
+
function cleanup() {
|
|
699
|
+
if (isDone) {
|
|
700
|
+
clearInterval(consumer);
|
|
701
|
+
clearInterval(healthCheck);
|
|
702
|
+
queue = [];
|
|
703
|
+
sentPacketsQueue = [];
|
|
704
|
+
self.close();
|
|
705
|
+
}
|
|
706
|
+
}
|
|
707
|
+
initConnect();
|
|
708
|
+
consumer = setInterval(function () {
|
|
709
|
+
if (retrySentPacket) {
|
|
710
|
+
for (var i = 0; i < sentPacketsQueue.length; i++) {
|
|
711
|
+
var retryPacket = sentPacketsQueue[i].packetData;
|
|
712
|
+
var res = send(retryPacket);
|
|
713
|
+
if (!res) break;
|
|
714
|
+
}
|
|
715
|
+
retrySentPacket = false;
|
|
716
|
+
} else {
|
|
717
|
+
while (queue.length > 0) {
|
|
718
|
+
var data = queue.shift();
|
|
719
|
+
var isSent = send(data);
|
|
720
|
+
if (!isSent) {
|
|
721
|
+
queue.unshift(data);
|
|
722
|
+
break;
|
|
723
|
+
}
|
|
724
|
+
if (shouldSendAudioDataSequence) {
|
|
725
|
+
var view = new DataView(data);
|
|
726
|
+
packetId = Number(view.getBigInt64(4));
|
|
727
|
+
var sentPacket = {
|
|
728
|
+
packetNumber: packetId,
|
|
729
|
+
packetData: data
|
|
730
|
+
};
|
|
731
|
+
sentPacketsQueue.push(sentPacket);
|
|
732
|
+
}
|
|
733
|
+
}
|
|
734
|
+
}
|
|
735
|
+
}, consumeInterval);
|
|
736
|
+
healthCheck = setInterval(function () {
|
|
737
|
+
if (ws && ws.readyState === WebSocket.OPEN) {
|
|
738
|
+
var currentTime = +new Date();
|
|
739
|
+
var isSocketClosingTime = switchToRegularSpeechProfile ? lastDataSent > lastDataReceived && currentTime - lastDataReceived > socketTimeoutInterval : currentTime - lastPingReceived > socketTimeoutInterval;
|
|
740
|
+
if (isSocketClosingTime) {
|
|
741
|
+
if (enableLogs) {
|
|
742
|
+
console.error("No data received since more than ".concat(socketTimeoutInterval / 1000, " secs, closing time..."));
|
|
743
|
+
}
|
|
744
|
+
ws.close();
|
|
745
|
+
}
|
|
746
|
+
}
|
|
747
|
+
}, healthcheckInterval);
|
|
748
|
+
self.onmessage = function (event) {
|
|
749
|
+
if (event.data === closeMessage) {
|
|
750
|
+
JobID = "";
|
|
751
|
+
isDone = true;
|
|
752
|
+
shouldNotReconnect = true;
|
|
753
|
+
ws.close();
|
|
754
|
+
} else if (event.data === doneMessage) {
|
|
755
|
+
add(eosMessage);
|
|
756
|
+
JobID = "";
|
|
757
|
+
if (enableLogs) {
|
|
758
|
+
console.log("Augnito: Worker received DONE, time to terminate...");
|
|
759
|
+
}
|
|
760
|
+
isDone = true;
|
|
761
|
+
} else if (event.data === pauseSocketMessage) {
|
|
762
|
+
shouldPauseSocket = true;
|
|
763
|
+
} else if (event.data === resumeSocketMessage) {
|
|
764
|
+
add(pauseStateAudio);
|
|
765
|
+
shouldPauseSocket = false;
|
|
766
|
+
pauseStateAudio = [];
|
|
767
|
+
} else {
|
|
768
|
+
if (shouldPauseSocket) {
|
|
769
|
+
pauseStateAudio = event.data;
|
|
770
|
+
} else add(event.data);
|
|
771
|
+
}
|
|
772
|
+
};
|
|
773
|
+
}
|
|
774
|
+
|
|
775
|
+
// worklet-thread
|
|
776
|
+
var worklet = "class MyAudioWorkletProcessor extends AudioWorkletProcessor {\n constructor() {\n super();\n this.accumulator = [];\n this.pauseSocketStreaming = false;\n this.sampleVal = 0;\n this.sampleSize = 0;\n this.intensityFrameCount = 0;\n this.reset();\n this.isProcessing = true;\n // message received from main-thread\n this.port.onmessage = (e) => {\n console.log(\"Augnito: Worklet received event - \", e.data);\n if (this.sampleSize > 0) {\n this.accumulator.push(this.sampleVal / this.sampleSize);\n }\n \n if (e.data == \"PAUSE\" || e.data == \"STOP\" || e.data == \"PAUSESOCKET\") {\n // append silence to get last word ASR.\n const silenceSize = 16000 * 2;\n for (let i = 0; i < silenceSize; i++) {\n this.accumulator.push(0);\n }\n }\n this.send();\n this.reset();\n if (e.data == \"STOP\") {\n // message sent to main-thread\n this.port.postMessage({type:\"DONE\", value:\"DONE\"});\n this.isProcessing = false;\n \n }\n if(e.data == \"PAUSESOCKET\"){\n this.pauseSocketStreaming = true;\n this.port.postMessage(\"PAUSESOCKET\");\n } else if(e.data == \"RESUMESOCKET\"){\n this.pauseSocketStreaming = false;\n } \n };\n }\n\n static get parameterDescriptors() {\n return [\n {\n name: \"sampleRate\",\n defaultValue: 16000,\n minValue: 16000,\n maxValue: 6 * 16000,\n },\n {\n name: \"bufferSizeInterval\",\n defaultValue: 1,\n minValue: 1,\n maxValue: 100,\n },\n {\n name: \"pausedBufferInterval\",\n defaultValue: 1,\n minValue: 0,\n maxValue: 100,\n },\n {\n name: \"shouldReadIntensity\",\n defaultValue: false,\n minValue: 0,\n maxValue: 1,\n },\n ];\n }\n\n // 128 frames\n process(inputList, outputList, params) {\n const input = inputList[0];\n if (input && input.length && input[0].length) {\n const channelData = input[0];\n const output = outputList[0];\n const inputSampleRate = params.sampleRate[0];\n const sampleRatio = inputSampleRate / 16000\n const bufferSizeInterval = params[\"bufferSizeInterval\"][0];\n const pausedBufferInterval = params[\"pausedBufferInterval\"][0];\n const shouldReadIntensity = params[\"shouldReadIntensity\"][0];\n\n let sumSquares = 0; // For intensity\n let sampleCount = 0;\n\n // console.log(\"BufferSizeInterval\", bufferSizeInterval);\n // Jackpot\n input[0].forEach((float32Element, index) => {\n const int16Element = Math.min(1, Math.max(-1, float32Element)) * 0x7fff;\n this.sampleVal += int16Element;\n this.sampleSize += 1;\n // Accumulate for intensity (RMS)\n sumSquares += float32Element * float32Element;\n sampleCount++;\n \n\n if (this.sampleSize >= sampleRatio) {\n const fraction = this.sampleSize - sampleRatio \n this.sampleVal -= fraction * int16Element;\n\n this.accumulator.push(this.sampleVal / sampleRatio);\n \n this.sampleVal = fraction * int16Element;\n this.sampleSize = fraction;\n }\n\n // Comment this when streaming microphone audio\n // output[0][index] = float32Element;\n });\n if(this.pauseSocketStreaming){\n if (this.accumulator.length >= 125 * 128 * pausedBufferInterval) {\n this.send();\n }\n } else{\n if (this.accumulator.length >= 125 * 128 * bufferSizeInterval) {\n this.send();\n }\n }\n if(shouldReadIntensity){\n \n // Throttled intensity post\n this.intensityFrameCount = (this.intensityFrameCount || 0) + 1;\n if (this.intensityFrameCount >= 15 && sampleCount > 0) {\n const rms = Math.sqrt(sumSquares / sampleCount);\n const normalized = Math.min(1, rms); // [0\u20131] scale\n this.port.postMessage({ type: 'intensity', value: normalized });\n this.intensityFrameCount = 0;\n }\n }\n }\n return this.isProcessing;\n }\n\n send() {\n if (this.accumulator.length == 0) return;\n const audioData = new Int16Array(this.accumulator);\n // message sent to main-thread - transferrable\n this.port.postMessage({ type: 'audioData', value: audioData.buffer }, [audioData.buffer]);\n this.accumulator = [];\n }\n\n reset() {\n this.sampleVal = 0;\n this.sampleSize = 0;\n }\n}\n\nregisterProcessor(\"worklet-processor\", MyAudioWorkletProcessor);";
|
|
777
|
+
|
|
778
|
+
// main-thread
|
|
779
|
+
var Streamer = /*#__PURE__*/function () {
|
|
780
|
+
function Streamer(enableLogs, isDebug, bufferSizeInterval, pausedBufferInterval, eosMessage, socketTimeoutInterval, shouldSendAudioDataSequence, shouldPreIntialiseRecorder, shouldReadIntensity, switchToRegularSpeechProfile, heavyOp, onFinalResult, onPartialResult, onError, onStateChanged, onSessionEvent, onOtherResults, onSpeechResponse, onIntensity) {
|
|
781
|
+
_classCallCheck(this, Streamer);
|
|
782
|
+
this.audioContext;
|
|
783
|
+
this.audioStream;
|
|
784
|
+
this.executor = new Executor(enableLogs, eosMessage, socketTimeoutInterval, shouldSendAudioDataSequence, onFinalResult, onPartialResult, onError, onSessionEvent, onOtherResults, onSpeechResponse, bufferSizeInterval, switchToRegularSpeechProfile);
|
|
785
|
+
this.executor.HeavyOp = heavyOp;
|
|
786
|
+
this.source;
|
|
787
|
+
this.processorNode;
|
|
788
|
+
this.isPaused = false;
|
|
789
|
+
this.isStreaming = false;
|
|
790
|
+
// Uncomment to save recording
|
|
791
|
+
this.audioData = [];
|
|
792
|
+
this.isDebug = isDebug;
|
|
793
|
+
this.enableLogs = enableLogs;
|
|
794
|
+
this.onStateChanged = onStateChanged;
|
|
795
|
+
this.onIntensity = onIntensity;
|
|
796
|
+
this.onError = onError;
|
|
797
|
+
this.bufferSizeInterval = bufferSizeInterval;
|
|
798
|
+
this.pausedBufferInterval = pausedBufferInterval !== null && pausedBufferInterval !== void 0 ? pausedBufferInterval : 1;
|
|
799
|
+
this.shouldReadIntensity = shouldReadIntensity;
|
|
800
|
+
this.closeSocketWithoutEOS = false;
|
|
801
|
+
this.shouldPreIntialiseRecorder = shouldPreIntialiseRecorder !== null && shouldPreIntialiseRecorder !== void 0 ? shouldPreIntialiseRecorder : false;
|
|
802
|
+
if (this.shouldPreIntialiseRecorder) {
|
|
803
|
+
this.EarlyInitialiseMediaStream();
|
|
804
|
+
}
|
|
805
|
+
}
|
|
806
|
+
return _createClass(Streamer, [{
|
|
807
|
+
key: "EarlyInitialiseMediaStream",
|
|
808
|
+
value: function () {
|
|
809
|
+
var _EarlyInitialiseMediaStream = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
810
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
811
|
+
while (1) switch (_context.prev = _context.next) {
|
|
812
|
+
case 0:
|
|
813
|
+
_context.next = 2;
|
|
814
|
+
return this.createMediaStreamSourceNode();
|
|
815
|
+
case 2:
|
|
816
|
+
if (!(this.audioContext && this.audioContext.state == "running")) {
|
|
817
|
+
_context.next = 5;
|
|
818
|
+
break;
|
|
819
|
+
}
|
|
820
|
+
_context.next = 5;
|
|
821
|
+
return this.audioContext.suspend();
|
|
822
|
+
case 5:
|
|
823
|
+
case "end":
|
|
824
|
+
return _context.stop();
|
|
825
|
+
}
|
|
826
|
+
}, _callee, this);
|
|
827
|
+
}));
|
|
828
|
+
function EarlyInitialiseMediaStream() {
|
|
829
|
+
return _EarlyInitialiseMediaStream.apply(this, arguments);
|
|
830
|
+
}
|
|
831
|
+
return EarlyInitialiseMediaStream;
|
|
832
|
+
}()
|
|
833
|
+
}, {
|
|
834
|
+
key: "StartStream",
|
|
835
|
+
value: function () {
|
|
836
|
+
var _StartStream = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(duration, wsUrl) {
|
|
837
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
838
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
839
|
+
case 0:
|
|
840
|
+
this.log("New stream started...");
|
|
841
|
+
|
|
842
|
+
// Uncomment to stream recorded audio
|
|
843
|
+
// await this.createBufferedSourceNode();
|
|
844
|
+
// Uncomment to stream microphone audio
|
|
845
|
+
if (!(!this.shouldPreIntialiseRecorder || !this.source)) {
|
|
846
|
+
_context2.next = 9;
|
|
847
|
+
break;
|
|
848
|
+
}
|
|
849
|
+
_context2.next = 4;
|
|
850
|
+
return this.createMediaStreamSourceNode();
|
|
851
|
+
case 4:
|
|
852
|
+
if (this.source) {
|
|
853
|
+
_context2.next = 7;
|
|
854
|
+
break;
|
|
855
|
+
}
|
|
856
|
+
console.error("Error: unable to create source node");
|
|
857
|
+
return _context2.abrupt("return", false);
|
|
858
|
+
case 7:
|
|
859
|
+
_context2.next = 12;
|
|
860
|
+
break;
|
|
861
|
+
case 9:
|
|
862
|
+
if (!(this.audioContext.state == "suspended")) {
|
|
863
|
+
_context2.next = 12;
|
|
864
|
+
break;
|
|
865
|
+
}
|
|
866
|
+
_context2.next = 12;
|
|
867
|
+
return this.audioContext.resume();
|
|
868
|
+
case 12:
|
|
869
|
+
_context2.next = 14;
|
|
870
|
+
return this.createProcessorNode();
|
|
871
|
+
case 14:
|
|
872
|
+
if (this.processorNode) {
|
|
873
|
+
_context2.next = 17;
|
|
874
|
+
break;
|
|
875
|
+
}
|
|
876
|
+
console.error("Error: unable to create processor node");
|
|
877
|
+
return _context2.abrupt("return", false);
|
|
878
|
+
case 17:
|
|
879
|
+
if (!this.IsMicrophoneMuted) {
|
|
880
|
+
_context2.next = 23;
|
|
881
|
+
break;
|
|
882
|
+
}
|
|
883
|
+
if (!(this.audioContext && this.audioContext.state == "running")) {
|
|
884
|
+
_context2.next = 21;
|
|
885
|
+
break;
|
|
886
|
+
}
|
|
887
|
+
_context2.next = 21;
|
|
888
|
+
return this.audioContext.suspend();
|
|
889
|
+
case 21:
|
|
890
|
+
this.onError(JSON.stringify({
|
|
891
|
+
Type: "ERROR",
|
|
892
|
+
Data: "Microphone is muted."
|
|
893
|
+
}));
|
|
894
|
+
return _context2.abrupt("return", false);
|
|
895
|
+
case 23:
|
|
896
|
+
if (wsUrl !== "") {
|
|
897
|
+
this.executor.Start(duration, wsUrl);
|
|
898
|
+
}
|
|
899
|
+
this.onStateChanged(true);
|
|
900
|
+
this.source.connect(this.processorNode).connect(this.audioContext.destination);
|
|
901
|
+
this.log("AudioContext Sample Rate: " + this.audioContext.sampleRate);
|
|
902
|
+
this.isStreaming = true;
|
|
903
|
+
return _context2.abrupt("return", true);
|
|
904
|
+
case 29:
|
|
905
|
+
case "end":
|
|
906
|
+
return _context2.stop();
|
|
907
|
+
}
|
|
908
|
+
}, _callee2, this);
|
|
909
|
+
}));
|
|
910
|
+
function StartStream(_x, _x2) {
|
|
911
|
+
return _StartStream.apply(this, arguments);
|
|
912
|
+
}
|
|
913
|
+
return StartStream;
|
|
914
|
+
}()
|
|
915
|
+
}, {
|
|
916
|
+
key: "createBufferedSourceNode",
|
|
917
|
+
value: function () {
|
|
918
|
+
var _createBufferedSourceNode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
919
|
+
var audioBuffer;
|
|
920
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
921
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
922
|
+
case 0:
|
|
923
|
+
_context3.next = 2;
|
|
924
|
+
return this.loadAudio();
|
|
925
|
+
case 2:
|
|
926
|
+
audioBuffer = _context3.sent;
|
|
927
|
+
if (audioBuffer) {
|
|
928
|
+
_context3.next = 6;
|
|
929
|
+
break;
|
|
930
|
+
}
|
|
931
|
+
console.error("Error: unable to create audio buffer");
|
|
932
|
+
return _context3.abrupt("return");
|
|
933
|
+
case 6:
|
|
934
|
+
this.source = this.audioContext.createBufferSource();
|
|
935
|
+
this.source.buffer = audioBuffer;
|
|
936
|
+
this.source.loop = LOOP_AUDIO;
|
|
937
|
+
this.source.start();
|
|
938
|
+
case 10:
|
|
939
|
+
case "end":
|
|
940
|
+
return _context3.stop();
|
|
941
|
+
}
|
|
942
|
+
}, _callee3, this);
|
|
943
|
+
}));
|
|
944
|
+
function createBufferedSourceNode() {
|
|
945
|
+
return _createBufferedSourceNode.apply(this, arguments);
|
|
946
|
+
}
|
|
947
|
+
return createBufferedSourceNode;
|
|
948
|
+
}()
|
|
949
|
+
}, {
|
|
950
|
+
key: "createMediaStreamSourceNode",
|
|
951
|
+
value: function () {
|
|
952
|
+
var _createMediaStreamSourceNode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
953
|
+
var _this = this;
|
|
954
|
+
var errMessage;
|
|
955
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
956
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
957
|
+
case 0:
|
|
958
|
+
_context4.prev = 0;
|
|
959
|
+
_context4.next = 3;
|
|
960
|
+
return navigator.mediaDevices.getUserMedia({
|
|
961
|
+
audio: {
|
|
962
|
+
channelCount: CHANNEL_COUNT,
|
|
963
|
+
noiseSuppression: NOISE_SUPPRESS_ENABLED
|
|
964
|
+
// sampleRate: SAMPLE_RATE,
|
|
965
|
+
// sampleSize: BITS_PER_SAMPLE,
|
|
966
|
+
}
|
|
967
|
+
});
|
|
968
|
+
case 3:
|
|
969
|
+
this.audioStream = _context4.sent;
|
|
970
|
+
this.audioContext = new AudioContext();
|
|
971
|
+
this.source = this.audioContext.createMediaStreamSource(this.audioStream);
|
|
972
|
+
this.audioStream.getAudioTracks()[0].addEventListener("ended", function () {
|
|
973
|
+
_this.onError(JSON.stringify({
|
|
974
|
+
Type: "ERROR",
|
|
975
|
+
Data: "Audio track ended. Possibly the mic was unplugged."
|
|
976
|
+
}));
|
|
977
|
+
});
|
|
978
|
+
_context4.next = 14;
|
|
979
|
+
break;
|
|
980
|
+
case 9:
|
|
981
|
+
_context4.prev = 9;
|
|
982
|
+
_context4.t0 = _context4["catch"](0);
|
|
983
|
+
errMessage = "";
|
|
984
|
+
if (_context4.t0.name == "NotAllowedError") {
|
|
985
|
+
errMessage = "Mic permission denied";
|
|
986
|
+
} else if (_context4.t0.name === "NotFoundError") {
|
|
987
|
+
errMessage = "No suitable media device found";
|
|
988
|
+
}
|
|
989
|
+
this.onError(JSON.stringify({
|
|
990
|
+
Type: "ERROR",
|
|
991
|
+
Data: errMessage
|
|
992
|
+
}));
|
|
993
|
+
case 14:
|
|
994
|
+
case "end":
|
|
995
|
+
return _context4.stop();
|
|
996
|
+
}
|
|
997
|
+
}, _callee4, this, [[0, 9]]);
|
|
998
|
+
}));
|
|
999
|
+
function createMediaStreamSourceNode() {
|
|
1000
|
+
return _createMediaStreamSourceNode.apply(this, arguments);
|
|
1001
|
+
}
|
|
1002
|
+
return createMediaStreamSourceNode;
|
|
1003
|
+
}()
|
|
1004
|
+
}, {
|
|
1005
|
+
key: "loadAudio",
|
|
1006
|
+
value: function () {
|
|
1007
|
+
var _loadAudio = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
|
1008
|
+
var response, arrayBuffer, audioBuffer;
|
|
1009
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
1010
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
1011
|
+
case 0:
|
|
1012
|
+
_context5.prev = 0;
|
|
1013
|
+
_context5.next = 3;
|
|
1014
|
+
return fetch("./radiology_speed_test.wav");
|
|
1015
|
+
case 3:
|
|
1016
|
+
response = _context5.sent;
|
|
1017
|
+
_context5.next = 6;
|
|
1018
|
+
return response.arrayBuffer();
|
|
1019
|
+
case 6:
|
|
1020
|
+
arrayBuffer = _context5.sent;
|
|
1021
|
+
_context5.next = 9;
|
|
1022
|
+
return this.audioContext.decodeAudioData(arrayBuffer);
|
|
1023
|
+
case 9:
|
|
1024
|
+
audioBuffer = _context5.sent;
|
|
1025
|
+
return _context5.abrupt("return", audioBuffer);
|
|
1026
|
+
case 13:
|
|
1027
|
+
_context5.prev = 13;
|
|
1028
|
+
_context5.t0 = _context5["catch"](0);
|
|
1029
|
+
console.error("Unable to fetch the audio file. Error: ".concat(_context5.t0.message));
|
|
1030
|
+
return _context5.abrupt("return", null);
|
|
1031
|
+
case 17:
|
|
1032
|
+
case "end":
|
|
1033
|
+
return _context5.stop();
|
|
1034
|
+
}
|
|
1035
|
+
}, _callee5, this, [[0, 13]]);
|
|
1036
|
+
}));
|
|
1037
|
+
function loadAudio() {
|
|
1038
|
+
return _loadAudio.apply(this, arguments);
|
|
1039
|
+
}
|
|
1040
|
+
return loadAudio;
|
|
1041
|
+
}()
|
|
1042
|
+
}, {
|
|
1043
|
+
key: "createProcessorNode",
|
|
1044
|
+
value: function () {
|
|
1045
|
+
var _createProcessorNode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
|
|
1046
|
+
var _this2 = this;
|
|
1047
|
+
var _this$shouldReadInten, sampleRateParam, bufferSizeIntervalParam, pausedBufferIntervalParam, shouldReadIntensityParam;
|
|
1048
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
1049
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
1050
|
+
case 0:
|
|
1051
|
+
_context6.prev = 0;
|
|
1052
|
+
_context6.next = 3;
|
|
1053
|
+
return this.audioContext.audioWorklet.addModule("data:application/javascript,".concat(encodeURIComponent(worklet)));
|
|
1054
|
+
case 3:
|
|
1055
|
+
this.processorNode = new AudioWorkletNode(this.audioContext, WORKLET_PROCESSOR);
|
|
1056
|
+
sampleRateParam = this.processorNode.parameters.get("sampleRate");
|
|
1057
|
+
sampleRateParam.setValueAtTime(this.audioContext.sampleRate, this.audioContext.currentTime);
|
|
1058
|
+
bufferSizeIntervalParam = this.processorNode.parameters.get("bufferSizeInterval");
|
|
1059
|
+
bufferSizeIntervalParam.setValueAtTime(this.bufferSizeInterval, this.audioContext.currentTime);
|
|
1060
|
+
pausedBufferIntervalParam = this.processorNode.parameters.get("pausedBufferInterval");
|
|
1061
|
+
pausedBufferIntervalParam.setValueAtTime(this.pausedBufferInterval, this.audioContext.currentTime);
|
|
1062
|
+
shouldReadIntensityParam = this.processorNode.parameters.get("shouldReadIntensity");
|
|
1063
|
+
shouldReadIntensityParam.setValueAtTime((_this$shouldReadInten = this.shouldReadIntensity) !== null && _this$shouldReadInten !== void 0 ? _this$shouldReadInten : false, this.audioContext.currentTime);
|
|
1064
|
+
// message received from worklet-thread
|
|
1065
|
+
this.processorNode.port.onmessage = function (event) {
|
|
1066
|
+
var _event$data = event.data,
|
|
1067
|
+
type = _event$data.type,
|
|
1068
|
+
value = _event$data.value;
|
|
1069
|
+
if (type == DONE_MSG) {
|
|
1070
|
+
_this2.log("Worklet processing done, clearing resources...");
|
|
1071
|
+
|
|
1072
|
+
// Uncomment to save recording
|
|
1073
|
+
if (_this2.isDebug) _this2.saveAudio();
|
|
1074
|
+
_this2.cleanup();
|
|
1075
|
+
} else if (event.data == PAUSE_SOCKET_MSG) {
|
|
1076
|
+
_this2.executor.Send(PAUSE_SOCKET_MSG);
|
|
1077
|
+
}
|
|
1078
|
+
// Uncomment to save recording
|
|
1079
|
+
else {
|
|
1080
|
+
if (type === "intensity") {
|
|
1081
|
+
var _this2$onIntensity;
|
|
1082
|
+
(_this2$onIntensity = _this2.onIntensity) === null || _this2$onIntensity === void 0 || _this2$onIntensity.call(_this2, value);
|
|
1083
|
+
} else if (type === "audioData") {
|
|
1084
|
+
if (_this2.isDebug) {
|
|
1085
|
+
new Int16Array(value).forEach(function (element) {
|
|
1086
|
+
if (_this2.audioData.length <= MAX_AUDIO_SAMPLES) _this2.audioData.push(element);
|
|
1087
|
+
});
|
|
1088
|
+
}
|
|
1089
|
+
}
|
|
1090
|
+
}
|
|
1091
|
+
if (_this2.executor) {
|
|
1092
|
+
if (_this2.closeSocketWithoutEOS) {
|
|
1093
|
+
_this2.executor.Send(CLOSE_MSG);
|
|
1094
|
+
_this2.closeSocketWithoutEOS = false;
|
|
1095
|
+
} else {
|
|
1096
|
+
if (type !== "intensity") _this2.executor.Send(value);
|
|
1097
|
+
}
|
|
1098
|
+
}
|
|
1099
|
+
};
|
|
1100
|
+
_context6.next = 18;
|
|
1101
|
+
break;
|
|
1102
|
+
case 15:
|
|
1103
|
+
_context6.prev = 15;
|
|
1104
|
+
_context6.t0 = _context6["catch"](0);
|
|
1105
|
+
console.error("Error: Unable to create worklet node: ", _context6.t0);
|
|
1106
|
+
case 18:
|
|
1107
|
+
case "end":
|
|
1108
|
+
return _context6.stop();
|
|
1109
|
+
}
|
|
1110
|
+
}, _callee6, this, [[0, 15]]);
|
|
1111
|
+
}));
|
|
1112
|
+
function createProcessorNode() {
|
|
1113
|
+
return _createProcessorNode.apply(this, arguments);
|
|
1114
|
+
}
|
|
1115
|
+
return createProcessorNode;
|
|
1116
|
+
}()
|
|
1117
|
+
}, {
|
|
1118
|
+
key: "PauseStream",
|
|
1119
|
+
value: function () {
|
|
1120
|
+
var _PauseStream = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
|
|
1121
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
1122
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
1123
|
+
case 0:
|
|
1124
|
+
if (!(this.audioContext.state == "running")) {
|
|
1125
|
+
_context7.next = 9;
|
|
1126
|
+
break;
|
|
1127
|
+
}
|
|
1128
|
+
if (this.shouldPreIntialiseRecorder) {
|
|
1129
|
+
_context7.next = 8;
|
|
1130
|
+
break;
|
|
1131
|
+
}
|
|
1132
|
+
_context7.next = 4;
|
|
1133
|
+
return this.audioContext.suspend();
|
|
1134
|
+
case 4:
|
|
1135
|
+
this.log("Stream paused...");
|
|
1136
|
+
// message sent to worklet-thread
|
|
1137
|
+
this.processorNode.port.postMessage(PAUSE_MSG);
|
|
1138
|
+
_context7.next = 9;
|
|
1139
|
+
break;
|
|
1140
|
+
case 8:
|
|
1141
|
+
this.processorNode.port.postMessage(PAUSE_SOCKET_MSG);
|
|
1142
|
+
case 9:
|
|
1143
|
+
this.onStateChanged(false);
|
|
1144
|
+
this.isPaused = true;
|
|
1145
|
+
this.isStreaming = false;
|
|
1146
|
+
case 12:
|
|
1147
|
+
case "end":
|
|
1148
|
+
return _context7.stop();
|
|
1149
|
+
}
|
|
1150
|
+
}, _callee7, this);
|
|
1151
|
+
}));
|
|
1152
|
+
function PauseStream() {
|
|
1153
|
+
return _PauseStream.apply(this, arguments);
|
|
1154
|
+
}
|
|
1155
|
+
return PauseStream;
|
|
1156
|
+
}()
|
|
1157
|
+
}, {
|
|
1158
|
+
key: "ResumeStream",
|
|
1159
|
+
value: function () {
|
|
1160
|
+
var _ResumeStream = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
|
|
1161
|
+
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
1162
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
1163
|
+
case 0:
|
|
1164
|
+
if (!(!this.shouldPreIntialiseRecorder && this.audioContext.state == "suspended")) {
|
|
1165
|
+
_context8.next = 9;
|
|
1166
|
+
break;
|
|
1167
|
+
}
|
|
1168
|
+
if (!this.IsMicrophoneMuted) {
|
|
1169
|
+
_context8.next = 4;
|
|
1170
|
+
break;
|
|
1171
|
+
}
|
|
1172
|
+
this.onError(JSON.stringify({
|
|
1173
|
+
Type: "ERROR",
|
|
1174
|
+
Data: "Microphone is muted."
|
|
1175
|
+
}));
|
|
1176
|
+
return _context8.abrupt("return");
|
|
1177
|
+
case 4:
|
|
1178
|
+
_context8.next = 6;
|
|
1179
|
+
return this.audioContext.resume();
|
|
1180
|
+
case 6:
|
|
1181
|
+
this.log("Stream resumed...");
|
|
1182
|
+
_context8.next = 11;
|
|
1183
|
+
break;
|
|
1184
|
+
case 9:
|
|
1185
|
+
this.processorNode.port.postMessage(RESUME_SOCKET_MSG);
|
|
1186
|
+
this.executor.Send(RESUME_SOCKET_MSG);
|
|
1187
|
+
case 11:
|
|
1188
|
+
this.onStateChanged(true);
|
|
1189
|
+
this.isPaused = false;
|
|
1190
|
+
this.isStreaming = true;
|
|
1191
|
+
case 14:
|
|
1192
|
+
case "end":
|
|
1193
|
+
return _context8.stop();
|
|
1194
|
+
}
|
|
1195
|
+
}, _callee8, this);
|
|
1196
|
+
}));
|
|
1197
|
+
function ResumeStream() {
|
|
1198
|
+
return _ResumeStream.apply(this, arguments);
|
|
1199
|
+
}
|
|
1200
|
+
return ResumeStream;
|
|
1201
|
+
}()
|
|
1202
|
+
}, {
|
|
1203
|
+
key: "IsPaused",
|
|
1204
|
+
get: function get() {
|
|
1205
|
+
return this.isPaused;
|
|
1206
|
+
}
|
|
1207
|
+
}, {
|
|
1208
|
+
key: "IsStreaming",
|
|
1209
|
+
get: function get() {
|
|
1210
|
+
return this.isStreaming;
|
|
1211
|
+
}
|
|
1212
|
+
}, {
|
|
1213
|
+
key: "IsMicrophoneMuted",
|
|
1214
|
+
get: function get() {
|
|
1215
|
+
return this.audioStream.getAudioTracks()[0].muted;
|
|
1216
|
+
}
|
|
1217
|
+
}, {
|
|
1218
|
+
key: "StopStream",
|
|
1219
|
+
value: function () {
|
|
1220
|
+
var _StopStream = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(shouldSendEOS) {
|
|
1221
|
+
var _this$audioContext, _this$processorNode, _this$audioStream;
|
|
1222
|
+
var _this$audioContext2;
|
|
1223
|
+
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
1224
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
1225
|
+
case 0:
|
|
1226
|
+
if (!(((_this$audioContext = this.audioContext) === null || _this$audioContext === void 0 ? void 0 : _this$audioContext.state) !== "suspended")) {
|
|
1227
|
+
_context9.next = 4;
|
|
1228
|
+
break;
|
|
1229
|
+
}
|
|
1230
|
+
_context9.next = 3;
|
|
1231
|
+
return (_this$audioContext2 = this.audioContext) === null || _this$audioContext2 === void 0 ? void 0 : _this$audioContext2.suspend();
|
|
1232
|
+
case 3:
|
|
1233
|
+
this.onStateChanged(false);
|
|
1234
|
+
case 4:
|
|
1235
|
+
this.log("Stream stopped...");
|
|
1236
|
+
this.isStreaming = false;
|
|
1237
|
+
this.closeSocketWithoutEOS = !shouldSendEOS;
|
|
1238
|
+
// message sent to worklet-thread
|
|
1239
|
+
(_this$processorNode = this.processorNode) === null || _this$processorNode === void 0 || (_this$processorNode = _this$processorNode.port) === null || _this$processorNode === void 0 || _this$processorNode.postMessage(STOP_MSG);
|
|
1240
|
+
(_this$audioStream = this.audioStream) === null || _this$audioStream === void 0 || _this$audioStream.getAudioTracks()[0].removeEventListener("ended", function () {});
|
|
1241
|
+
case 9:
|
|
1242
|
+
case "end":
|
|
1243
|
+
return _context9.stop();
|
|
1244
|
+
}
|
|
1245
|
+
}, _callee9, this);
|
|
1246
|
+
}));
|
|
1247
|
+
function StopStream(_x3) {
|
|
1248
|
+
return _StopStream.apply(this, arguments);
|
|
1249
|
+
}
|
|
1250
|
+
return StopStream;
|
|
1251
|
+
}()
|
|
1252
|
+
}, {
|
|
1253
|
+
key: "cleanup",
|
|
1254
|
+
value: function cleanup() {
|
|
1255
|
+
// Uncomment to stop recorded audio
|
|
1256
|
+
// this.source.stop();
|
|
1257
|
+
// Uncomment to stop microphone audio
|
|
1258
|
+
this.source.mediaStream.getAudioTracks()[0].stop();
|
|
1259
|
+
this.source.disconnect();
|
|
1260
|
+
this.processorNode.disconnect();
|
|
1261
|
+
this.processorNode.port.close();
|
|
1262
|
+
this.audioContext.close();
|
|
1263
|
+
this.audioData = [];
|
|
1264
|
+
}
|
|
1265
|
+
}, {
|
|
1266
|
+
key: "saveAudio",
|
|
1267
|
+
value: function saveAudio() {
|
|
1268
|
+
var wavView = this.encodeWAV();
|
|
1269
|
+
var url = URL.createObjectURL(new Blob([wavView], {
|
|
1270
|
+
type: "audio/wav"
|
|
1271
|
+
}));
|
|
1272
|
+
this.log("Download Recording: ".concat(url));
|
|
1273
|
+
}
|
|
1274
|
+
|
|
1275
|
+
/**
|
|
1276
|
+
* Returns a Blob object containing the audio data in WAV format.
|
|
1277
|
+
* @returns {Blob} - Blob object containing the audio data in WAV format.
|
|
1278
|
+
*/
|
|
1279
|
+
}, {
|
|
1280
|
+
key: "getBlob",
|
|
1281
|
+
value: function getBlob() {
|
|
1282
|
+
var wavView = this.encodeWAV();
|
|
1283
|
+
console.log(wavView);
|
|
1284
|
+
var audioBlob = new Blob([wavView], {
|
|
1285
|
+
type: "audio/wav"
|
|
1286
|
+
});
|
|
1287
|
+
console.log(audioBlob);
|
|
1288
|
+
return audioBlob;
|
|
1289
|
+
}
|
|
1290
|
+
|
|
1291
|
+
// 16-bit PCM mono audio @ 16kHz
|
|
1292
|
+
}, {
|
|
1293
|
+
key: "encodeWAV",
|
|
1294
|
+
value: function encodeWAV() {
|
|
1295
|
+
// DataView to hold audio data, 2 bytes per int16
|
|
1296
|
+
var view = new DataView(new ArrayBuffer(this.audioData.length * 2));
|
|
1297
|
+
this.audioData.forEach(function (value, index) {
|
|
1298
|
+
view.setInt16(index * 2, value, true);
|
|
1299
|
+
});
|
|
1300
|
+
var dataLength = view.buffer.byteLength;
|
|
1301
|
+
var fileSize = 44 + dataLength;
|
|
1302
|
+
var wavView = new DataView(new ArrayBuffer(fileSize));
|
|
1303
|
+
|
|
1304
|
+
// WAV header
|
|
1305
|
+
wavView.setUint32(0, 0x52494646, false); // "RIFF" in ASCII
|
|
1306
|
+
wavView.setUint32(4, fileSize - 8, true);
|
|
1307
|
+
wavView.setUint32(8, 0x57415645, false); // "WAVE" in ASCII
|
|
1308
|
+
wavView.setUint32(12, 0x666d7420, false); // "fmt " in ASCII
|
|
1309
|
+
wavView.setUint32(16, 16, true); // Size of the "fmt" chunk
|
|
1310
|
+
wavView.setUint16(20, 1, true); // Audio format (PCM)
|
|
1311
|
+
wavView.setUint16(22, CHANNEL_COUNT, true);
|
|
1312
|
+
wavView.setUint32(24, SAMPLE_RATE, true);
|
|
1313
|
+
wavView.setUint32(28, SAMPLE_RATE * CHANNEL_COUNT * (BITS_PER_SAMPLE / 8), true); // Byte rate
|
|
1314
|
+
wavView.setUint16(32, CHANNEL_COUNT * (BITS_PER_SAMPLE / 8), true);
|
|
1315
|
+
wavView.setUint16(34, BITS_PER_SAMPLE, true);
|
|
1316
|
+
wavView.setUint32(36, 0x64617461, false); // "data" in ASCII
|
|
1317
|
+
wavView.setUint32(40, dataLength, true);
|
|
1318
|
+
|
|
1319
|
+
// Write the audio data to the WAV file
|
|
1320
|
+
for (var i = 0; i < dataLength; i++) {
|
|
1321
|
+
wavView.setInt8(44 + i, view.getInt8(i));
|
|
1322
|
+
}
|
|
1323
|
+
return wavView;
|
|
1324
|
+
}
|
|
1325
|
+
}, {
|
|
1326
|
+
key: "log",
|
|
1327
|
+
value: function log(event) {
|
|
1328
|
+
if (this.enableLogs) {
|
|
1329
|
+
var data = "".concat(new Date().toLocaleTimeString(), " Augnito: ").concat(event);
|
|
1330
|
+
console.log(data + "\n");
|
|
1331
|
+
}
|
|
1332
|
+
}
|
|
1333
|
+
}]);
|
|
1334
|
+
}();
|
|
1335
|
+
|
|
1336
|
+
var AugnitoRecorder = /*#__PURE__*/function () {
|
|
1337
|
+
function AugnitoRecorder() {
|
|
1338
|
+
var _config$serverURL, _config$switchToRegul, _config$debounceDelay;
|
|
1339
|
+
var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
|
|
1340
|
+
serverURL: "",
|
|
1341
|
+
enableLogs: false,
|
|
1342
|
+
isDebug: false,
|
|
1343
|
+
bufferInterval: 1,
|
|
1344
|
+
pausedBufferInterval: 1,
|
|
1345
|
+
EOS_Message: undefined,
|
|
1346
|
+
socketTimeoutInterval: undefined,
|
|
1347
|
+
shouldSendAudioDataSequence: false,
|
|
1348
|
+
shouldPreIntialiseRecorder: false,
|
|
1349
|
+
shouldReadIntensity: false,
|
|
1350
|
+
debounceDelay: 300,
|
|
1351
|
+
switchToRegularSpeechProfile: false
|
|
1352
|
+
};
|
|
1353
|
+
var heavyOp = arguments.length > 1 ? arguments[1] : undefined;
|
|
1354
|
+
_classCallCheck(this, AugnitoRecorder);
|
|
1355
|
+
if (AugnitoRecorder.instance) {
|
|
1356
|
+
return AugnitoRecorder.instance;
|
|
1357
|
+
}
|
|
1358
|
+
this.WebsocketURL = (_config$serverURL = config.serverURL) !== null && _config$serverURL !== void 0 ? _config$serverURL : "";
|
|
1359
|
+
this.enableLogs = config.enableLogs;
|
|
1360
|
+
this.isDebug = config.isDebug;
|
|
1361
|
+
this.streamer = null;
|
|
1362
|
+
this.streamerNotStarted = false;
|
|
1363
|
+
this.isStreamerStarting = false;
|
|
1364
|
+
this.heavyOp = heavyOp;
|
|
1365
|
+
this.bufferInterval = config.bufferInterval;
|
|
1366
|
+
this.pausedBufferInterval = config.pausedBufferInterval;
|
|
1367
|
+
this.eosMessage = config.EOS_Message;
|
|
1368
|
+
this.socketTimeoutInterval = config.socketTimeoutInterval;
|
|
1369
|
+
this.shouldSendAudioDataSequence = config.shouldSendAudioDataSequence;
|
|
1370
|
+
this.shouldPreIntialiseRecorder = config.shouldPreIntialiseRecorder;
|
|
1371
|
+
this.switchToRegularSpeechProfile = (_config$switchToRegul = config.switchToRegularSpeechProfile) !== null && _config$switchToRegul !== void 0 ? _config$switchToRegul : false;
|
|
1372
|
+
if (this.shouldPreIntialiseRecorder) {
|
|
1373
|
+
this.initialiseStreamer();
|
|
1374
|
+
this.streamerNotStarted = true;
|
|
1375
|
+
}
|
|
1376
|
+
this.shouldReadIntensity = config.shouldReadIntensity;
|
|
1377
|
+
this.delay = (_config$debounceDelay = config.debounceDelay) !== null && _config$debounceDelay !== void 0 ? _config$debounceDelay : 300;
|
|
1378
|
+
this.toggleStartStopAudioStream = debounce(this.toggleStartStopAudioStream.bind(this), this.delay);
|
|
1379
|
+
this.togglePauseResumeAudioStream = debounce(this.togglePauseResumeAudioStream.bind(this), this.delay);
|
|
1380
|
+
AugnitoRecorder.instance = this;
|
|
1381
|
+
}
|
|
1382
|
+
return _createClass(AugnitoRecorder, [{
|
|
1383
|
+
key: "initialiseStreamer",
|
|
1384
|
+
value: function initialiseStreamer() {
|
|
1385
|
+
this.streamer = new Streamer(this.enableLogs, this.isDebug, this.bufferInterval, this.pausedBufferInterval, this.eosMessage, this.socketTimeoutInterval, this.shouldSendAudioDataSequence, this.shouldPreIntialiseRecorder, this.shouldReadIntensity, this.switchToRegularSpeechProfile, this.heavyOp, this.onFinalResultCallback.bind(this), this.onPartialResultCallback.bind(this), this.onErrorCallback.bind(this), this.onStateChangedCallback.bind(this), this.onSessionEventCallback.bind(this), this.onOtherResultCallback.bind(this), this.onSpeechResponseCallback.bind(this), this.onIntensityCallback.bind(this));
|
|
1386
|
+
}
|
|
1387
|
+
}, {
|
|
1388
|
+
key: "togglePauseResumeAudioStream",
|
|
1389
|
+
value: function togglePauseResumeAudioStream() {
|
|
1390
|
+
var audioDuration = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
1391
|
+
var socketUrl = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined;
|
|
1392
|
+
if (!this.streamer || this.streamerNotStarted) {
|
|
1393
|
+
if (socketUrl) {
|
|
1394
|
+
this.WebsocketURL = socketUrl;
|
|
1395
|
+
}
|
|
1396
|
+
this.startAudio(audioDuration);
|
|
1397
|
+
} else {
|
|
1398
|
+
if (this.streamer.IsPaused) {
|
|
1399
|
+
this.resumeAudio();
|
|
1400
|
+
} else {
|
|
1401
|
+
this.pauseAudio();
|
|
1402
|
+
}
|
|
1403
|
+
}
|
|
1404
|
+
}
|
|
1405
|
+
}, {
|
|
1406
|
+
key: "toggleStartStopAudioStream",
|
|
1407
|
+
value: function toggleStartStopAudioStream() {
|
|
1408
|
+
var audioDuration = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
1409
|
+
var socketUrl = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined;
|
|
1410
|
+
if (!this.streamer || this.streamerNotStarted) {
|
|
1411
|
+
if (socketUrl) {
|
|
1412
|
+
this.WebsocketURL = socketUrl;
|
|
1413
|
+
}
|
|
1414
|
+
this.startAudio(audioDuration);
|
|
1415
|
+
} else {
|
|
1416
|
+
this.stopAudio();
|
|
1417
|
+
}
|
|
1418
|
+
}
|
|
1419
|
+
}, {
|
|
1420
|
+
key: "startAudio",
|
|
1421
|
+
value: function () {
|
|
1422
|
+
var _startAudio = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(duration) {
|
|
1423
|
+
var res;
|
|
1424
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
1425
|
+
while (1) switch (_context.prev = _context.next) {
|
|
1426
|
+
case 0:
|
|
1427
|
+
if (!this.isStreamerStarting) {
|
|
1428
|
+
_context.next = 2;
|
|
1429
|
+
break;
|
|
1430
|
+
}
|
|
1431
|
+
return _context.abrupt("return");
|
|
1432
|
+
case 2:
|
|
1433
|
+
// Prevent concurrent starts
|
|
1434
|
+
|
|
1435
|
+
this.isStreamerStarting = true;
|
|
1436
|
+
if (!this.shouldPreIntialiseRecorder || !this.streamer) {
|
|
1437
|
+
this.initialiseStreamer();
|
|
1438
|
+
}
|
|
1439
|
+
_context.prev = 4;
|
|
1440
|
+
_context.next = 7;
|
|
1441
|
+
return this.streamer.StartStream(duration, this.WebsocketURL);
|
|
1442
|
+
case 7:
|
|
1443
|
+
res = _context.sent;
|
|
1444
|
+
if (!res) {
|
|
1445
|
+
this.streamer = null;
|
|
1446
|
+
} else {
|
|
1447
|
+
this.streamerNotStarted = false;
|
|
1448
|
+
this.log("Stream Started...");
|
|
1449
|
+
}
|
|
1450
|
+
case 9:
|
|
1451
|
+
_context.prev = 9;
|
|
1452
|
+
this.isStreamerStarting = false;
|
|
1453
|
+
return _context.finish(9);
|
|
1454
|
+
case 12:
|
|
1455
|
+
case "end":
|
|
1456
|
+
return _context.stop();
|
|
1457
|
+
}
|
|
1458
|
+
}, _callee, this, [[4,, 9, 12]]);
|
|
1459
|
+
}));
|
|
1460
|
+
function startAudio(_x) {
|
|
1461
|
+
return _startAudio.apply(this, arguments);
|
|
1462
|
+
}
|
|
1463
|
+
return startAudio;
|
|
1464
|
+
}()
|
|
1465
|
+
}, {
|
|
1466
|
+
key: "pauseAudio",
|
|
1467
|
+
value: function pauseAudio() {
|
|
1468
|
+
this.streamer.PauseStream();
|
|
1469
|
+
this.log("Stream Paused...");
|
|
1470
|
+
}
|
|
1471
|
+
}, {
|
|
1472
|
+
key: "resumeAudio",
|
|
1473
|
+
value: function resumeAudio() {
|
|
1474
|
+
this.streamer.ResumeStream();
|
|
1475
|
+
if (this.enableLogs) this.log("Stream Resumed...");
|
|
1476
|
+
}
|
|
1477
|
+
|
|
1478
|
+
/*
|
|
1479
|
+
* param forceStopForPausedState set to true for Ambient to send EOS in paused state
|
|
1480
|
+
*/
|
|
1481
|
+
}, {
|
|
1482
|
+
key: "stopAudio",
|
|
1483
|
+
value: function stopAudio() {
|
|
1484
|
+
var _this$streamer;
|
|
1485
|
+
var shouldSendEOS = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
1486
|
+
var forceStopForPausedState = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
1487
|
+
if ((_this$streamer = this.streamer) !== null && _this$streamer !== void 0 && _this$streamer.IsStreaming || forceStopForPausedState) {
|
|
1488
|
+
var _this$streamer2;
|
|
1489
|
+
(_this$streamer2 = this.streamer) === null || _this$streamer2 === void 0 || _this$streamer2.StopStream(shouldSendEOS);
|
|
1490
|
+
this.streamer = null;
|
|
1491
|
+
this.log("Stream Stopped...");
|
|
1492
|
+
if (this.shouldPreIntialiseRecorder) {
|
|
1493
|
+
this.initialiseStreamer();
|
|
1494
|
+
this.streamerNotStarted = true;
|
|
1495
|
+
}
|
|
1496
|
+
}
|
|
1497
|
+
}
|
|
1498
|
+
}, {
|
|
1499
|
+
key: "getBlob",
|
|
1500
|
+
value: function getBlob() {
|
|
1501
|
+
var audioBlob = this.streamer.getBlob();
|
|
1502
|
+
this.log("Blob Sent...");
|
|
1503
|
+
return audioBlob;
|
|
1504
|
+
}
|
|
1505
|
+
}, {
|
|
1506
|
+
key: "log",
|
|
1507
|
+
value: function log(event) {
|
|
1508
|
+
if (this.enableLogs) {
|
|
1509
|
+
var data = "".concat(new Date().toLocaleTimeString(), " Augnito: ").concat(event);
|
|
1510
|
+
this.showLogCallback(data + "\n");
|
|
1511
|
+
}
|
|
1512
|
+
}
|
|
1513
|
+
}, {
|
|
1514
|
+
key: "dispose",
|
|
1515
|
+
value: function dispose() {
|
|
1516
|
+
AugnitoRecorder.instance = null;
|
|
1517
|
+
}
|
|
1518
|
+
|
|
1519
|
+
// #endregion
|
|
1520
|
+
// #region client callbacks
|
|
1521
|
+
}, {
|
|
1522
|
+
key: "onSessionEventCallback",
|
|
1523
|
+
value: function onSessionEventCallback(data) {
|
|
1524
|
+
if (this.onSessionEvent) {
|
|
1525
|
+
this.onSessionEvent(data);
|
|
1526
|
+
}
|
|
1527
|
+
}
|
|
1528
|
+
}, {
|
|
1529
|
+
key: "onStateChangedCallback",
|
|
1530
|
+
value: function onStateChangedCallback(isRecording) {
|
|
1531
|
+
if (this.onStateChanged) {
|
|
1532
|
+
this.onStateChanged(isRecording);
|
|
1533
|
+
}
|
|
1534
|
+
}
|
|
1535
|
+
}, {
|
|
1536
|
+
key: "onIntensityCallback",
|
|
1537
|
+
value: function onIntensityCallback(intensity) {
|
|
1538
|
+
if (this.onIntensity) {
|
|
1539
|
+
this.onIntensity(intensity);
|
|
1540
|
+
}
|
|
1541
|
+
}
|
|
1542
|
+
}, {
|
|
1543
|
+
key: "onErrorCallback",
|
|
1544
|
+
value: function onErrorCallback(errorMessage) {
|
|
1545
|
+
if (this.onError) {
|
|
1546
|
+
this.onError(errorMessage);
|
|
1547
|
+
}
|
|
1548
|
+
}
|
|
1549
|
+
}, {
|
|
1550
|
+
key: "onPartialResultCallback",
|
|
1551
|
+
value: function onPartialResultCallback(hype) {
|
|
1552
|
+
if (this.onPartialResult) {
|
|
1553
|
+
this.onPartialResult(hype);
|
|
1554
|
+
}
|
|
1555
|
+
}
|
|
1556
|
+
}, {
|
|
1557
|
+
key: "onFinalResultCallback",
|
|
1558
|
+
value: function onFinalResultCallback(recipe) {
|
|
1559
|
+
if (this.onFinalResult) {
|
|
1560
|
+
this.onFinalResult(recipe);
|
|
1561
|
+
}
|
|
1562
|
+
}
|
|
1563
|
+
}, {
|
|
1564
|
+
key: "onOtherResultCallback",
|
|
1565
|
+
value: function onOtherResultCallback(message) {
|
|
1566
|
+
if (this.onOtherResults) {
|
|
1567
|
+
this.onOtherResults(message);
|
|
1568
|
+
}
|
|
1569
|
+
}
|
|
1570
|
+
}, {
|
|
1571
|
+
key: "onSpeechResponseCallback",
|
|
1572
|
+
value: function onSpeechResponseCallback(message) {
|
|
1573
|
+
if (this.onSpeechResponse) {
|
|
1574
|
+
this.onSpeechResponse(message);
|
|
1575
|
+
}
|
|
1576
|
+
}
|
|
1577
|
+
}, {
|
|
1578
|
+
key: "showLogCallback",
|
|
1579
|
+
value: function showLogCallback(event) {
|
|
1580
|
+
if (this.showLog) {
|
|
1581
|
+
this.showLog(event);
|
|
1582
|
+
}
|
|
1583
|
+
}
|
|
1584
|
+
}]);
|
|
1585
|
+
}();
|
|
1586
|
+
function debounce(fn, delay) {
|
|
1587
|
+
var timeoutId;
|
|
1588
|
+
return function () {
|
|
1589
|
+
var _this = this;
|
|
1590
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
1591
|
+
args[_key] = arguments[_key];
|
|
1592
|
+
}
|
|
1593
|
+
if (timeoutId) clearTimeout(timeoutId);
|
|
1594
|
+
timeoutId = setTimeout(function () {
|
|
1595
|
+
return fn.apply(_this, args);
|
|
1596
|
+
}, delay);
|
|
1597
|
+
};
|
|
1598
|
+
}
|
|
1599
|
+
|
|
1600
|
+
export { AugnitoRecorder };
|
|
1601
|
+
//# sourceMappingURL=augnitoRecorder.js.map
|