scribe-widget 1.0.11 → 1.0.13
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/dist/scribe-widget.es.js
CHANGED
|
@@ -21197,13 +21197,11 @@ async function retryWrapper(i, e = {}) {
|
|
|
21197
21197
|
}
|
|
21198
21198
|
async function uploadFileWithFormData(i, e, s, c, h) {
|
|
21199
21199
|
const $ = async () => {
|
|
21200
|
-
const _ =
|
|
21201
|
-
_.append("file", s, e);
|
|
21202
|
-
const j = await fetch(i, {
|
|
21200
|
+
const _ = i.endsWith("/") ? `${i}${e}` : `${i}/${e}`, j = await fetch(_, {
|
|
21203
21201
|
method: "POST",
|
|
21204
|
-
body:
|
|
21202
|
+
body: s,
|
|
21205
21203
|
headers: {
|
|
21206
|
-
|
|
21204
|
+
"Content-Type": "audio/mp3",
|
|
21207
21205
|
...c || {}
|
|
21208
21206
|
}
|
|
21209
21207
|
});
|
|
@@ -21266,7 +21264,7 @@ class AudioFileManager {
|
|
|
21266
21264
|
type: AUDIO_EXTENSION_TYPE_MAP[OUTPUT_FORMAT]
|
|
21267
21265
|
});
|
|
21268
21266
|
console.log("Uploading to URL:", this.uploadUrl, "filename:", s);
|
|
21269
|
-
const _ = uploadFileWithFormData(this.uploadUrl, s,
|
|
21267
|
+
const _ = uploadFileWithFormData(this.uploadUrl, s, $, this.uploadHeaders).then((j) => {
|
|
21270
21268
|
var nt;
|
|
21271
21269
|
return j.success ? (this.successfulUploads.push(s), c !== -1 && this.audioChunks[c] && (this.audioChunks[c] = {
|
|
21272
21270
|
...this.audioChunks[c],
|
|
@@ -21316,7 +21314,7 @@ class AudioFileManager {
|
|
|
21316
21314
|
});
|
|
21317
21315
|
}
|
|
21318
21316
|
if (nt) {
|
|
21319
|
-
const et = uploadFileWithFormData(this.uploadUrl, h, nt).then((b) => {
|
|
21317
|
+
const et = uploadFileWithFormData(this.uploadUrl, h, nt, this.uploadHeaders).then((b) => {
|
|
21320
21318
|
var a;
|
|
21321
21319
|
return b.success && (this.successfulUploads.push(h), this.audioChunks[c] = {
|
|
21322
21320
|
...this.audioChunks[c],
|
|
@@ -35422,11 +35420,9 @@ class VadWebClient {
|
|
|
35422
35420
|
(b = this.audioFileManager) == null || b.incrementTotalRawSamples($), (a = this.audioBufferManager) == null || a.append($);
|
|
35423
35421
|
const { isSpeech: _ } = h;
|
|
35424
35422
|
let j = 0;
|
|
35425
|
-
_ >= 0.5 && (j = 1), this.checkNoSpeech(j)
|
|
35426
|
-
const nt = this.processVadFrame(j), et = nt[0];
|
|
35427
|
-
if (console.log("is clip point:", et, " at index:", nt[1]), et) {
|
|
35423
|
+
if (_ >= 0.5 && (j = 1), this.checkNoSpeech(j), this.processVadFrame(j)[0]) {
|
|
35428
35424
|
const d = (o = this.audioBufferManager) == null ? void 0 : o.getAudioData();
|
|
35429
|
-
|
|
35425
|
+
d && this.processAudioChunk({ audioFrames: d });
|
|
35430
35426
|
}
|
|
35431
35427
|
},
|
|
35432
35428
|
onSpeechStart: () => {
|
|
@@ -35449,7 +35445,7 @@ class VadWebClient {
|
|
|
35449
35445
|
async processAudioChunk({ audioFrames: e }) {
|
|
35450
35446
|
if (!e || !this.audioFileManager || !this.audioBufferManager)
|
|
35451
35447
|
return;
|
|
35452
|
-
const c = `
|
|
35448
|
+
const c = `chunk_${(this.audioFileManager.audioChunks.length || 0) + 1}.${OUTPUT_FORMAT}`, h = this.audioFileManager.getRawSampleDetails(), $ = this.audioBufferManager.calculateChunkTimestamps(h.totalRawSamples);
|
|
35453
35449
|
try {
|
|
35454
35450
|
const _ = {
|
|
35455
35451
|
fileName: c,
|
|
@@ -35460,7 +35456,7 @@ class VadWebClient {
|
|
|
35460
35456
|
status: "pending",
|
|
35461
35457
|
audioFrames: e
|
|
35462
35458
|
}, j = this.audioFileManager.updateAudioInfo(_);
|
|
35463
|
-
this.audioFileManager.incrementInsertedSamples(this.audioBufferManager.getCurrentSampleLength(), this.audioBufferManager.getCurrentFrameLength()), this.audioBufferManager.resetBufferState(),
|
|
35459
|
+
this.audioFileManager.incrementInsertedSamples(this.audioBufferManager.getCurrentSampleLength(), this.audioBufferManager.getCurrentFrameLength()), this.audioBufferManager.resetBufferState(), await this.audioFileManager.uploadAudio({
|
|
35464
35460
|
audioFrames: e,
|
|
35465
35461
|
fileName: c,
|
|
35466
35462
|
chunkIndex: j - 1
|