@innovastudio/contentbuilder 1.4.81 → 1.4.82
Sign up to get free protection for your applications and to get access to all the features.
package/package.json
CHANGED
@@ -77822,10 +77822,22 @@ class Dictation {
|
|
77822
77822
|
stopDictation() {
|
77823
77823
|
if (this.recognition) this.recognition.abort();
|
77824
77824
|
this.aborted = true;
|
77825
|
-
|
77826
|
-
|
77827
|
-
|
77828
|
-
|
77825
|
+
|
77826
|
+
// Using RecordRTC
|
77827
|
+
// if(this.recorder) this.recorder.stopRecording();
|
77828
|
+
// if(this.localStream) this.localStream.getAudioTracks().forEach(track => {
|
77829
|
+
// track.stop();
|
77830
|
+
// });
|
77831
|
+
|
77832
|
+
// Using mediaRecorder
|
77833
|
+
if (this.mediaRecorder && this.mediaRecorder.state !== 'inactive') {
|
77834
|
+
this.mediaRecorder.stop();
|
77835
|
+
this.localStream.getTracks().forEach(track => track.stop()); // Stop the tracks to release the resources
|
77836
|
+
}
|
77837
|
+
|
77838
|
+
if (this.websocket && this.websocket.readyState === WebSocket.OPEN) {
|
77839
|
+
this.websocket.close();
|
77840
|
+
}
|
77829
77841
|
}
|
77830
77842
|
async startDictation() {
|
77831
77843
|
const inpCommand = this.modalCommand.querySelector('.inp-command');
|
@@ -77879,9 +77891,14 @@ class Dictation {
|
|
77879
77891
|
sampleRate: sampleRate
|
77880
77892
|
}
|
77881
77893
|
}).then(stream => {
|
77894
|
+
this.localStream = stream;
|
77882
77895
|
this.mediaRecorder = new MediaRecorder(stream);
|
77883
77896
|
this.mediaRecorder.addEventListener('dataavailable', event => {
|
77897
|
+
if (this.aborted) return;
|
77898
|
+
|
77884
77899
|
// console.log(event.data);
|
77900
|
+
// if (event.data.size > 0) {
|
77901
|
+
// }
|
77885
77902
|
this.websocket.send(event.data);
|
77886
77903
|
});
|
77887
77904
|
|