@eka-care/ekascribe-ts-sdk 1.5.36 → 1.5.38
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.
|
@@ -238,15 +238,21 @@ class VadWebClient {
|
|
|
238
238
|
const audioFileManager = EkaScribeStore.audioFileManagerInstance;
|
|
239
239
|
const audioBuffer = EkaScribeStore.audioBufferInstance;
|
|
240
240
|
this.is_vad_loading = true;
|
|
241
|
-
const vadFrameProcessedCallback = EkaScribeStore.vadFrameProcessedCallback;
|
|
242
241
|
const vad = await MicVAD.new({
|
|
243
242
|
frameSamples: this.frame_size,
|
|
244
243
|
preSpeechPadFrames: this.speech_pad_frames,
|
|
245
244
|
onFrameProcessed: (prob, frames) => {
|
|
246
245
|
console.log(frames, 'frames in vad web');
|
|
246
|
+
// Get callback dynamically to ensure it's always up to date
|
|
247
|
+
const vadFrameProcessedCallback = EkaScribeStore.vadFrameProcessedCallback;
|
|
248
|
+
console.log('VAD callback exists:', !!vadFrameProcessedCallback, 'Recording started:', this.recording_started);
|
|
247
249
|
if (vadFrameProcessedCallback) {
|
|
248
250
|
vadFrameProcessedCallback({ probabilities: prob, frame: frames });
|
|
249
251
|
}
|
|
252
|
+
// Only process frames internally when recording is active
|
|
253
|
+
if (!this.recording_started) {
|
|
254
|
+
return;
|
|
255
|
+
}
|
|
250
256
|
audioFileManager?.incrementTotalRawSamples(frames);
|
|
251
257
|
audioBuffer?.append(frames);
|
|
252
258
|
// Check if audio chunk needs to be clipped
|
package/dist/store/store.js
CHANGED