@eka-care/ekascribe-ts-sdk 2.1.48 → 2.1.49
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/index.d.ts +1 -1
- package/dist/index.mjs +54 -14
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -51,7 +51,7 @@ declare class EkaScribe {
|
|
|
51
51
|
initTransaction(request: TPostTransactionInitRequest, sharedWorkerUrl?: string): Promise<TStartRecordingResponse>;
|
|
52
52
|
startRecording(microphoneID?: string): Promise<TStartRecordingResponse>;
|
|
53
53
|
startRecordingForExistingSession(request: TStartRecordingForExistingSessionRequest): Promise<TStartRecordingResponse>;
|
|
54
|
-
reinitializeVad(): void
|
|
54
|
+
reinitializeVad(): Promise<void>;
|
|
55
55
|
destroyVad(): void;
|
|
56
56
|
pauseVad(): void;
|
|
57
57
|
pauseRecording(): TPauseRecordingResponse;
|
package/dist/index.mjs
CHANGED
|
@@ -29617,7 +29617,11 @@ class VadWebClient {
|
|
|
29617
29617
|
* reinitialize the vad instance
|
|
29618
29618
|
*/
|
|
29619
29619
|
async reinitializeVad(n) {
|
|
29620
|
-
|
|
29620
|
+
try {
|
|
29621
|
+
return await this.initVad(n);
|
|
29622
|
+
} catch (i) {
|
|
29623
|
+
console.error("[EkaScribe] Error in reinitializeVad:", i);
|
|
29624
|
+
}
|
|
29621
29625
|
}
|
|
29622
29626
|
/**
|
|
29623
29627
|
* process and upload audio chunk to s3
|
|
@@ -29682,36 +29686,60 @@ class VadWebClient {
|
|
|
29682
29686
|
* Start VAD
|
|
29683
29687
|
*/
|
|
29684
29688
|
startVad() {
|
|
29685
|
-
|
|
29689
|
+
try {
|
|
29690
|
+
if (this.recording_started) return;
|
|
29691
|
+
this.micVad && typeof this.micVad.start == "function" && this.micVad.start(), this.recording_started = !0;
|
|
29692
|
+
} catch (n) {
|
|
29693
|
+
console.error("[EkaScribe] Error in startVad:", n);
|
|
29694
|
+
}
|
|
29686
29695
|
}
|
|
29687
29696
|
/**
|
|
29688
29697
|
* Pause VAD
|
|
29689
29698
|
*/
|
|
29690
29699
|
pauseVad() {
|
|
29691
|
-
|
|
29700
|
+
try {
|
|
29701
|
+
if (!this.recording_started) return;
|
|
29702
|
+
this.micVad && typeof this.micVad.pause == "function" && this.micVad.pause(), this.recording_started = !1;
|
|
29703
|
+
} catch (n) {
|
|
29704
|
+
console.error("[EkaScribe] Error in pauseVad:", n);
|
|
29705
|
+
}
|
|
29692
29706
|
}
|
|
29693
29707
|
/**
|
|
29694
29708
|
* End VAD
|
|
29695
29709
|
*/
|
|
29696
29710
|
destroyVad() {
|
|
29697
|
-
|
|
29711
|
+
try {
|
|
29712
|
+
this.micVad && typeof this.micVad.destroy == "function" && this.micVad.destroy(), this.stopMicStream(), this.recording_started = !1;
|
|
29713
|
+
} catch (n) {
|
|
29714
|
+
console.error("[EkaScribe] Error in destroyVad:", n);
|
|
29715
|
+
}
|
|
29698
29716
|
}
|
|
29699
29717
|
/**
|
|
29700
29718
|
* reset vadWeb instance
|
|
29701
29719
|
*/
|
|
29702
29720
|
resetVadWebInstance() {
|
|
29703
|
-
|
|
29721
|
+
try {
|
|
29722
|
+
this.micVad && typeof this.micVad.destroy == "function" && this.micVad.destroy(), this.stopMicStream(), this.vad_frame_count = 0, this.last_clip_index = 0, this.last_clip_point = 0, this.sil_duration_acc = 0, this.noSpeechStartTime = null, this.lastWarningTime = null, this.recording_started = !1, this.is_vad_loading = !0;
|
|
29723
|
+
} catch (n) {
|
|
29724
|
+
console.error("[EkaScribe] Error in resetVadWebInstance:", n);
|
|
29725
|
+
}
|
|
29704
29726
|
}
|
|
29705
29727
|
/**
|
|
29706
29728
|
* monitor initial audio capture within starting 4 seconds
|
|
29707
29729
|
*/
|
|
29708
29730
|
monitorAudioCapture() {
|
|
29709
29731
|
const n = EkaScribeStore$1.audioBufferInstance, i = EkaScribeStore$1.vadFramesCallback;
|
|
29710
|
-
setTimeout(() =>
|
|
29711
|
-
|
|
29712
|
-
|
|
29713
|
-
|
|
29714
|
-
|
|
29732
|
+
setTimeout(() => {
|
|
29733
|
+
try {
|
|
29734
|
+
return n && n.getCurrentSampleLength() <= 0 ? (this.micVad && typeof this.micVad.pause == "function" && this.micVad.pause(), i && i({
|
|
29735
|
+
message: "No audio is being captured. Please check your microphone.",
|
|
29736
|
+
error_code: ERROR_CODE.NO_AUDIO_CAPTURE,
|
|
29737
|
+
status_code: SDK_STATUS_CODE.AUDIO_ERROR
|
|
29738
|
+
}), !1) : !0;
|
|
29739
|
+
} catch (c) {
|
|
29740
|
+
return console.error("[EkaScribe] Error in monitorAudioCapture:", c), !1;
|
|
29741
|
+
}
|
|
29742
|
+
}, 5e3);
|
|
29715
29743
|
}
|
|
29716
29744
|
/**
|
|
29717
29745
|
* Callback to configure constants
|
|
@@ -31871,14 +31899,26 @@ const _n = class _n {
|
|
|
31871
31899
|
async startRecordingForExistingSession(n) {
|
|
31872
31900
|
return await startRecordingForExistingSession(n);
|
|
31873
31901
|
}
|
|
31874
|
-
reinitializeVad() {
|
|
31875
|
-
|
|
31902
|
+
async reinitializeVad() {
|
|
31903
|
+
try {
|
|
31904
|
+
await this.vadInstance.reinitializeVad();
|
|
31905
|
+
} catch (n) {
|
|
31906
|
+
console.error("[EkaScribe] Error in reinitializeVad:", n);
|
|
31907
|
+
}
|
|
31876
31908
|
}
|
|
31877
31909
|
destroyVad() {
|
|
31878
|
-
|
|
31910
|
+
try {
|
|
31911
|
+
this.vadInstance.destroyVad();
|
|
31912
|
+
} catch (n) {
|
|
31913
|
+
console.error("[EkaScribe] Error in destroyVad:", n);
|
|
31914
|
+
}
|
|
31879
31915
|
}
|
|
31880
31916
|
pauseVad() {
|
|
31881
|
-
|
|
31917
|
+
try {
|
|
31918
|
+
this.vadInstance.pauseVad();
|
|
31919
|
+
} catch (n) {
|
|
31920
|
+
console.error("[EkaScribe] Error in pauseVad:", n);
|
|
31921
|
+
}
|
|
31882
31922
|
}
|
|
31883
31923
|
pauseRecording() {
|
|
31884
31924
|
return pauseVoiceRecording();
|