@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 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
- return await this.initVad(n);
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
- this.recording_started || (this.micVad && typeof this.micVad.start == "function" && this.micVad.start(), this.recording_started = !0);
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
- this.recording_started && (this.micVad && typeof this.micVad.pause == "function" && this.micVad.pause(), this.recording_started = !1);
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
- this.micVad && typeof this.micVad.destroy == "function" && this.micVad.destroy(), this.stopMicStream(), this.recording_started = !1;
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
- 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;
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(() => n && n.getCurrentSampleLength() <= 0 ? (this.micVad.pause(), i && i({
29711
- message: "No audio is being captured. Please check your microphone.",
29712
- error_code: ERROR_CODE.NO_AUDIO_CAPTURE,
29713
- status_code: SDK_STATUS_CODE.AUDIO_ERROR
29714
- }), !1) : !0, 5e3);
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
- this.vadInstance.reinitializeVad();
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
- this.vadInstance.destroyVad();
31910
+ try {
31911
+ this.vadInstance.destroyVad();
31912
+ } catch (n) {
31913
+ console.error("[EkaScribe] Error in destroyVad:", n);
31914
+ }
31879
31915
  }
31880
31916
  pauseVad() {
31881
- this.vadInstance.pauseVad();
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();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eka-care/ekascribe-ts-sdk",
3
- "version": "2.1.48",
3
+ "version": "2.1.49",
4
4
  "description": "EkaScribe TypeScript SDK - Modern ES2020 build",
5
5
  "main": "dist/index.mjs",
6
6
  "module": "dist/index.mjs",