@innovastudio/contentbox 1.5.63 → 1.5.64

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@innovastudio/contentbox",
3
3
  "type": "module",
4
- "version": "1.5.63",
4
+ "version": "1.5.64",
5
5
  "description": "",
6
6
  "main": "public/contentbox/contentbox.esm.js",
7
7
  "files": [
@@ -50,7 +50,7 @@
50
50
  "ws": "^8.13.0"
51
51
  },
52
52
  "dependencies": {
53
- "@innovastudio/contentbuilder": "^1.4.81",
53
+ "@innovastudio/contentbuilder": "^1.4.82",
54
54
  "js-beautify": "^1.14.0"
55
55
  }
56
56
  }
@@ -92960,10 +92960,22 @@ class Dictation {
92960
92960
  stopDictation() {
92961
92961
  if (this.recognition) this.recognition.abort();
92962
92962
  this.aborted = true;
92963
- if (this.recorder) this.recorder.stopRecording();
92964
- if (this.localStream) this.localStream.getAudioTracks().forEach(track => {
92965
- track.stop();
92966
- });
92963
+
92964
+ // Using RecordRTC
92965
+ // if(this.recorder) this.recorder.stopRecording();
92966
+ // if(this.localStream) this.localStream.getAudioTracks().forEach(track => {
92967
+ // track.stop();
92968
+ // });
92969
+
92970
+ // Using mediaRecorder
92971
+ if (this.mediaRecorder && this.mediaRecorder.state !== 'inactive') {
92972
+ this.mediaRecorder.stop();
92973
+ this.localStream.getTracks().forEach(track => track.stop()); // Stop the tracks to release the resources
92974
+ }
92975
+
92976
+ if (this.websocket && this.websocket.readyState === WebSocket.OPEN) {
92977
+ this.websocket.close();
92978
+ }
92967
92979
  }
92968
92980
  async startDictation() {
92969
92981
  const inpCommand = this.modalCommand.querySelector('.inp-command');
@@ -93017,9 +93029,14 @@ class Dictation {
93017
93029
  sampleRate: sampleRate
93018
93030
  }
93019
93031
  }).then(stream => {
93032
+ this.localStream = stream;
93020
93033
  this.mediaRecorder = new MediaRecorder(stream);
93021
93034
  this.mediaRecorder.addEventListener('dataavailable', event => {
93035
+ if (this.aborted) return;
93036
+
93022
93037
  // console.log(event.data);
93038
+ // if (event.data.size > 0) {
93039
+ // }
93023
93040
  this.websocket.send(event.data);
93024
93041
  });
93025
93042