@tilde-nlp/asr-api-client
Advanced tools
Comparing version 2.0.6 to 2.0.7
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["asr-api-client"]=t():e["asr-api-client"]=t()}(self,(()=>(()=>{"use strict";var e={607:function(e,t,i){var o=this&&this.__createBinding||(Object.create?function(e,t,i,o){void 0===o&&(o=i);var s=Object.getOwnPropertyDescriptor(t,i);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[i]}}),Object.defineProperty(e,o,s)}:function(e,t,i,o){void 0===o&&(o=i),e[o]=t[i]}),s=this&&this.__exportStar||function(e,t){for(var i in e)"default"===i||Object.prototype.hasOwnProperty.call(t,i)||o(t,e,i)};Object.defineProperty(t,"__esModule",{value:!0}),s(i(86),t),s(i(801),t),s(i(729),t),s(i(216),t),s(i(321),t)},86:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.AsrClient=void 0;const o=i(326),s=i(729),n=i(321);t.AsrClient=class{get isRecording(){return this._isRecording}constructor(e){var t;this._isRecording=!1,this.mimeType="audio/pcm",this.url=e.url,this.visualizerConfigBase=e.visualizerConfig,this.timeSlice=e.timeSlice>0?e.timeSlice:200,this.channelCount=null!==(t=e.channelCount)&&void 0!==t?t:1,this.onResult=e.onResult,this.onMessage=e.onMessage,this.onError=e.onError,this.onStopped=e.onStopped,this.onRecordingStartStop=e.onRecordingStartStop}beginVoiceRecognition(){this.speechWebSocket||this.setUpMic().then((()=>{this.setupSpeechWebSocket().then((()=>{var e;null===(e=this.mediaRecorder)||void 0===e||e.start(this.timeSlice),this.setIsRecording(!0)}))}),(()=>{}))}listenToWebSocket(){this.setupSpeechWebSocket()}endVoiceRecognition(e=!1){this.stopRecording(!e),e&&this.closeWebSocket()}setUpMic(){return new Promise(((e,t)=>{navigator.mediaDevices.getUserMedia({audio:!0}).then((t=>{var i;if(this.audioContext=new AudioContext,null===(i=this.visualizerConfigBase)||void 0===i?void 0:i.visualizerId){const e={audioContext:this.audioContext,stream:t,visualizerId:this.visualizerConfigBase.visualizerId,strokeStyle:this.visualizerConfigBase.strokeStyle,lineWidth:this.visualizerConfigBase.lineWidth};this.audioVisualizer=new o.AudioVisualizer(e)}this.mediaRecorder=new MediaStreamRecorder(t),this.mediaRecorder.mimeType=this.mimeType,this.mediaRecorder.audioChannels=this.channelCount,this.mediaRecorder.ondataavailable=e=>{e.arrayBuffer().then((e=>{var t=new Uint8Array(e);this.sendMessageIfSocketOpen(t)}))},e()})).catch((e=>{this.onError&&(this.onError(e),t(e))}))}))}stopRecording(e=!0){var t,i,o,s;this.closeWebsocketOnNextFinal=e,null===(t=this.mediaRecorder)||void 0===t||t.stop(),this.setIsRecording(!1),null===(o=null===(i=this.inputStream)||void 0===i?void 0:i.mediaStream)||void 0===o||o.getAudioTracks().forEach((e=>e.stop())),null===(s=this.audioVisualizer)||void 0===s||s.stop(),this.audioVisualizer=void 0,this.sendEndOfStream()}setupSpeechWebSocket(){return new Promise((e=>{this.speechWebSocket=new WebSocket(`${this.url}`),this.speechWebSocket.binaryType="arraybuffer",this.speechWebSocket.onopen=async()=>{const t=JSON.stringify({"enable-final-postprocess":["numbers","punct"]});this.speechWebSocket.send(t),e()},this.speechWebSocket.onmessage=e=>{try{const t=JSON.parse(e.data);switch(t.status){case s.RecognitionStatus.Success:t.result&&this.handleSpeechRecognitionResult(t.result);break;case s.RecognitionStatus.StreamIssue:case s.RecognitionStatus.Aborted:case s.RecognitionStatus.Busy:this.handleError();break;default:this.onMessage&&this.onMessage(t.status)}}catch(t){this.handleSpeechRecognitionResult(e.data)}},this.speechWebSocket.onclose=e=>{this.speechWebSocket=void 0,this.onStopped&&this.onStopped()}}))}handleError(){this.speechWebSocket.close(3e3,"Server issue"),this.beginVoiceRecognition()}handleSpeechRecognitionResult(e){this.onResult&&this.onResult(e),("string"==typeof e||e.final)&&this.closeWebsocketOnNextFinal&&this.closeWebSocket()}setIsRecording(e){this._isRecording=e,this.onRecordingStartStop&&this.onRecordingStartStop(this.isRecording,this)}closeWebSocket(){var e;null===(e=this.speechWebSocket)||void 0===e||e.close(),this.closeWebsocketOnNextFinal=!1}sendEndOfStream(){this.sendMessageIfSocketOpen(n.END_OF_STREAM_MESSAGE)}sendMessageIfSocketOpen(e){this.speechWebSocket&&this.speechWebSocket.readyState===this.speechWebSocket.OPEN&&this.speechWebSocket.send(e)}}},326:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.AudioVisualizer=void 0,t.AudioVisualizer=class{constructor(e){var t;this.audioContext=e.audioContext,this.visualizerId=e.visualizerId,this.stream=e.stream,this.strokeStyle=null!==(t=e.strokeStyle)&&void 0!==t?t:"#811331",this.lineWidth=e.lineWidth}visualizeAudio(){if(this.stream){if(this.visualizerId){const e=this.audioContext.createMediaStreamSource(this.stream);this.analyser=this.audioContext.createAnalyser(),this.analyser.fftSize=512,this.analyser.smoothingTimeConstant=.95,e.connect(this.analyser)}this.draw()}else console.error("Audio visualizer has no stream! Try creating new visualizer")}stop(){if(this.visualizerId){const o=document.getElementById(this.visualizerId);if(o){var e=o.offsetWidth,t=o.height,i=o.getContext("2d");null==i||i.clearRect(0,0,e,t)}}this.audioVisualizerAnimReqId&&cancelAnimationFrame(this.audioVisualizerAnimReqId),this.stream&&(this.stream.getAudioTracks().forEach((e=>e.stop())),this.analyser=void 0,this.audioContext=void 0,this.stream=void 0,this.audioVisualizerAnimReqId=void 0)}draw(){var e;const t=this.analyser.frequencyBinCount,i=new Uint8Array(t),o=document.getElementById(this.visualizerId);if(o){const t=o.offsetWidth,s=o.offsetHeight,n=o.getContext("2d"),r=null!==(e=this.lineWidth)&&void 0!==e?e:t/i.length;if(n){n.lineWidth=r,n.strokeStyle=this.strokeStyle,this.analyser.getByteFrequencyData(i),n.clearRect(0,0,t,s),n.beginPath();let e=0;if(i){for(let t=0;t<i.length;t++){const o=i[t]/255*s;n.imageSmoothingEnabled=!1,n.moveTo(e,s),n.lineTo(e,s-o),e+=r}n.stroke()}}this.audioVisualizerAnimReqId=requestAnimationFrame((()=>{this.draw()}))}}}},729:function(e,t,i){var o=this&&this.__createBinding||(Object.create?function(e,t,i,o){void 0===o&&(o=i);var s=Object.getOwnPropertyDescriptor(t,i);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[i]}}),Object.defineProperty(e,o,s)}:function(e,t,i,o){void 0===o&&(o=i),e[o]=t[i]}),s=this&&this.__exportStar||function(e,t){for(var i in e)"default"===i||Object.prototype.hasOwnProperty.call(t,i)||o(t,e,i)};Object.defineProperty(t,"__esModule",{value:!0}),s(i(883),t)},883:(e,t)=>{var i;Object.defineProperty(t,"__esModule",{value:!0}),t.RecognitionStatus=void 0,(i=t.RecognitionStatus||(t.RecognitionStatus={}))[i.Success=0]="Success",i[i.NoSpeech=1]="NoSpeech",i[i.Aborted=2]="Aborted",i[i.StreamIssue=5]="StreamIssue",i[i.LoadLimitReached=9]="LoadLimitReached",i[i.AuthenticationFailed=10]="AuthenticationFailed",i[i.Busy=11]="Busy"},88:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.sha1Async=void 0,t.sha1Async=async e=>{const t=(new TextEncoder).encode(e),i=await crypto.subtle.digest("SHA-1",t);return Array.from(new Uint8Array(i)).map((e=>e.toString(16).padStart(2,"0"))).join("")}},216:function(e,t,i){var o=this&&this.__createBinding||(Object.create?function(e,t,i,o){void 0===o&&(o=i);var s=Object.getOwnPropertyDescriptor(t,i);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[i]}}),Object.defineProperty(e,o,s)}:function(e,t,i,o){void 0===o&&(o=i),e[o]=t[i]}),s=this&&this.__exportStar||function(e,t){for(var i in e)"default"===i||Object.prototype.hasOwnProperty.call(t,i)||o(t,e,i)};Object.defineProperty(t,"__esModule",{value:!0}),s(i(88),t)},17:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},801:function(e,t,i){var o=this&&this.__createBinding||(Object.create?function(e,t,i,o){void 0===o&&(o=i);var s=Object.getOwnPropertyDescriptor(t,i);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[i]}}),Object.defineProperty(e,o,s)}:function(e,t,i,o){void 0===o&&(o=i),e[o]=t[i]}),s=this&&this.__exportStar||function(e,t){for(var i in e)"default"===i||Object.prototype.hasOwnProperty.call(t,i)||o(t,e,i)};Object.defineProperty(t,"__esModule",{value:!0}),s(i(17),t),s(i(208),t),s(i(957),t),s(i(289),t),s(i(310),t)},289:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},208:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},957:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},310:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},38:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.END_OF_STREAM_MESSAGE=void 0,t.END_OF_STREAM_MESSAGE="EOS"},321:function(e,t,i){var o=this&&this.__createBinding||(Object.create?function(e,t,i,o){void 0===o&&(o=i);var s=Object.getOwnPropertyDescriptor(t,i);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[i]}}),Object.defineProperty(e,o,s)}:function(e,t,i,o){void 0===o&&(o=i),e[o]=t[i]}),s=this&&this.__exportStar||function(e,t){for(var i in e)"default"===i||Object.prototype.hasOwnProperty.call(t,i)||o(t,e,i)};Object.defineProperty(t,"__esModule",{value:!0}),s(i(38),t)}},t={};return function i(o){var s=t[o];if(void 0!==s)return s.exports;var n=t[o]={exports:{}};return e[o].call(n.exports,n,n.exports,i),n.exports}(607)})())); | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["asr-api-client"]=t():e["asr-api-client"]=t()}(self,(()=>(()=>{"use strict";var e={607:function(e,t,i){var s=this&&this.__createBinding||(Object.create?function(e,t,i,s){void 0===s&&(s=i);var o=Object.getOwnPropertyDescriptor(t,i);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[i]}}),Object.defineProperty(e,s,o)}:function(e,t,i,s){void 0===s&&(s=i),e[s]=t[i]}),o=this&&this.__exportStar||function(e,t){for(var i in e)"default"===i||Object.prototype.hasOwnProperty.call(t,i)||s(t,e,i)};Object.defineProperty(t,"__esModule",{value:!0}),o(i(86),t),o(i(801),t),o(i(729),t),o(i(216),t),o(i(321),t)},86:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.AsrClient=void 0;const s=i(326),o=i(729),n=i(321);t.AsrClient=class{get isRecording(){return this._isRecording}constructor(e){var t,i,s;this._isRecording=!1,this.mimeType="audio/pcm",this.url=e.url,this.visualizerConfigBase=e.visualizerConfig,this.timeSlice=e.timeSlice>0?e.timeSlice:200,this.channelCount=null!==(t=e.channelCount)&&void 0!==t?t:1,this.eosTimeoutMs=null!==(i=e.eosTimeoutMs)&&void 0!==i?i:200,this.isDebug=null!==(s=e.debug)&&void 0!==s&&s,this.onResult=e.onResult,this.onMessage=e.onMessage,this.onError=e.onError,this.onStopped=e.onStopped,this.onRecordingStartStop=e.onRecordingStartStop}beginVoiceRecognition(){this.speechWebSocket||this.setUpMic().then((()=>{this.setupSpeechWebSocket().then((()=>{var e;null===(e=this.mediaRecorder)||void 0===e||e.start(this.timeSlice),this.setIsRecording(!0)}))}),(()=>{}))}listenToWebSocket(){this.setupSpeechWebSocket()}endVoiceRecognition(e=!1){this.stopRecording(),e&&this.closeWebSocket()}setUpMic(){return new Promise(((e,t)=>{navigator.mediaDevices.getUserMedia({audio:!0}).then((t=>{var i;if(this.audioContext=new AudioContext,null===(i=this.visualizerConfigBase)||void 0===i?void 0:i.visualizerId){const e={audioContext:this.audioContext,stream:t,visualizerId:this.visualizerConfigBase.visualizerId,strokeStyle:this.visualizerConfigBase.strokeStyle,lineWidth:this.visualizerConfigBase.lineWidth};this.audioVisualizer=new s.AudioVisualizer(e)}this.mediaRecorder=new MediaStreamRecorder(t),this.mediaRecorder.mimeType=this.mimeType,this.mediaRecorder.audioChannels=this.channelCount,this.mediaRecorder.ondataavailable=e=>{e.arrayBuffer().then((t=>{this.debug("On data available callback called",e);var i=new Uint8Array(t);this.sendMessageIfSocketOpen(i)}))},e()})).catch((e=>{this.onError&&(this.onError(e),t(e))}))}))}stopRecording(){var e,t,i,s;this.debug("Stopping recording"),null===(e=this.mediaRecorder)||void 0===e||e.stop(),this.setIsRecording(!1),null===(i=null===(t=this.inputStream)||void 0===t?void 0:t.mediaStream)||void 0===i||i.getAudioTracks().forEach((e=>e.stop())),null===(s=this.audioVisualizer)||void 0===s||s.stop(),this.audioVisualizer=void 0,this.debug("Recording stopped"),this.sendEndOfStream()}setupSpeechWebSocket(){return new Promise((e=>{this.speechWebSocket=new WebSocket(`${this.url}`),this.speechWebSocket.binaryType="arraybuffer",this.speechWebSocket.onopen=async()=>{const t=JSON.stringify({"enable-final-postprocess":["numbers","punct"]});this.speechWebSocket.send(t),e()},this.speechWebSocket.onmessage=e=>{const t=JSON.parse(e.data);try{switch(t.status){case o.RecognitionStatus.Success:t.result&&this.handleSpeechRecognitionResult(t.result);break;case o.RecognitionStatus.StreamIssue:case o.RecognitionStatus.Aborted:case o.RecognitionStatus.Busy:this.handleError();break;default:this.onMessage&&this.onMessage(t.status)}}catch(t){this.handleSpeechRecognitionResult(e.data)}this.EOSsent&&t.adaptation_state&&(this.debug("EOS message is sent and received message with adaptation_state property, closing ws"),this.closeWebSocket())},this.speechWebSocket.onclose=e=>{this.debug("ws on close callback"),this.speechWebSocket=void 0,this.onStopped&&this.onStopped()}}))}handleError(){this.speechWebSocket.close(3e3,"Server issue"),this.beginVoiceRecognition()}handleSpeechRecognitionResult(e){this.onResult&&this.onResult(e)}setIsRecording(e){this._isRecording=e,this.onRecordingStartStop&&this.onRecordingStartStop(this.isRecording,this)}closeWebSocket(){var e;this.debug("Closing web socket"),null===(e=this.speechWebSocket)||void 0===e||e.close(),this.EOSsent=!1}sendEndOfStream(){const e=()=>{this.debug("sending EOS"),this.sendMessageIfSocketOpen(n.END_OF_STREAM_MESSAGE),this.EOSsent=!0,this.debug("EOS sent")};if(this.eosTimeoutMs)return this.debug(`Waiting for EOS message timeout: ${this.eosTimeoutMs}`),void setTimeout((()=>{this.debug("Entered EOS timeout callback"),e()}),this.eosTimeoutMs);e()}sendMessageIfSocketOpen(e){this.speechWebSocket&&this.speechWebSocket.readyState===this.speechWebSocket.OPEN&&this.speechWebSocket.send(e)}debug(e,...t){this.isDebug&&console.debug(e,t)}}},326:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.AudioVisualizer=void 0,t.AudioVisualizer=class{constructor(e){var t;this.audioContext=e.audioContext,this.visualizerId=e.visualizerId,this.stream=e.stream,this.strokeStyle=null!==(t=e.strokeStyle)&&void 0!==t?t:"#811331",this.lineWidth=e.lineWidth}visualizeAudio(){if(this.stream){if(this.visualizerId){const e=this.audioContext.createMediaStreamSource(this.stream);this.analyser=this.audioContext.createAnalyser(),this.analyser.fftSize=512,this.analyser.smoothingTimeConstant=.95,e.connect(this.analyser)}this.draw()}else console.error("Audio visualizer has no stream! Try creating new visualizer")}stop(){if(this.visualizerId){const s=document.getElementById(this.visualizerId);if(s){var e=s.offsetWidth,t=s.height,i=s.getContext("2d");null==i||i.clearRect(0,0,e,t)}}this.audioVisualizerAnimReqId&&cancelAnimationFrame(this.audioVisualizerAnimReqId),this.stream&&(this.stream.getAudioTracks().forEach((e=>e.stop())),this.analyser=void 0,this.audioContext=void 0,this.stream=void 0,this.audioVisualizerAnimReqId=void 0)}draw(){var e;const t=this.analyser.frequencyBinCount,i=new Uint8Array(t),s=document.getElementById(this.visualizerId);if(s){const t=s.offsetWidth,o=s.offsetHeight,n=s.getContext("2d"),r=null!==(e=this.lineWidth)&&void 0!==e?e:t/i.length;if(n){n.lineWidth=r,n.strokeStyle=this.strokeStyle,this.analyser.getByteFrequencyData(i),n.clearRect(0,0,t,o),n.beginPath();let e=0;if(i){for(let t=0;t<i.length;t++){const s=i[t]/255*o;n.imageSmoothingEnabled=!1,n.moveTo(e,o),n.lineTo(e,o-s),e+=r}n.stroke()}}this.audioVisualizerAnimReqId=requestAnimationFrame((()=>{this.draw()}))}}}},729:function(e,t,i){var s=this&&this.__createBinding||(Object.create?function(e,t,i,s){void 0===s&&(s=i);var o=Object.getOwnPropertyDescriptor(t,i);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[i]}}),Object.defineProperty(e,s,o)}:function(e,t,i,s){void 0===s&&(s=i),e[s]=t[i]}),o=this&&this.__exportStar||function(e,t){for(var i in e)"default"===i||Object.prototype.hasOwnProperty.call(t,i)||s(t,e,i)};Object.defineProperty(t,"__esModule",{value:!0}),o(i(883),t)},883:(e,t)=>{var i;Object.defineProperty(t,"__esModule",{value:!0}),t.RecognitionStatus=void 0,(i=t.RecognitionStatus||(t.RecognitionStatus={}))[i.Success=0]="Success",i[i.NoSpeech=1]="NoSpeech",i[i.Aborted=2]="Aborted",i[i.StreamIssue=5]="StreamIssue",i[i.LoadLimitReached=9]="LoadLimitReached",i[i.AuthenticationFailed=10]="AuthenticationFailed",i[i.Busy=11]="Busy"},88:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.sha1Async=void 0,t.sha1Async=async e=>{const t=(new TextEncoder).encode(e),i=await crypto.subtle.digest("SHA-1",t);return Array.from(new Uint8Array(i)).map((e=>e.toString(16).padStart(2,"0"))).join("")}},216:function(e,t,i){var s=this&&this.__createBinding||(Object.create?function(e,t,i,s){void 0===s&&(s=i);var o=Object.getOwnPropertyDescriptor(t,i);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[i]}}),Object.defineProperty(e,s,o)}:function(e,t,i,s){void 0===s&&(s=i),e[s]=t[i]}),o=this&&this.__exportStar||function(e,t){for(var i in e)"default"===i||Object.prototype.hasOwnProperty.call(t,i)||s(t,e,i)};Object.defineProperty(t,"__esModule",{value:!0}),o(i(88),t)},17:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},801:function(e,t,i){var s=this&&this.__createBinding||(Object.create?function(e,t,i,s){void 0===s&&(s=i);var o=Object.getOwnPropertyDescriptor(t,i);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[i]}}),Object.defineProperty(e,s,o)}:function(e,t,i,s){void 0===s&&(s=i),e[s]=t[i]}),o=this&&this.__exportStar||function(e,t){for(var i in e)"default"===i||Object.prototype.hasOwnProperty.call(t,i)||s(t,e,i)};Object.defineProperty(t,"__esModule",{value:!0}),o(i(17),t),o(i(208),t),o(i(957),t),o(i(289),t),o(i(310),t)},289:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},208:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},957:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},310:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},38:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.END_OF_STREAM_MESSAGE=void 0,t.END_OF_STREAM_MESSAGE="EOS"},321:function(e,t,i){var s=this&&this.__createBinding||(Object.create?function(e,t,i,s){void 0===s&&(s=i);var o=Object.getOwnPropertyDescriptor(t,i);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[i]}}),Object.defineProperty(e,s,o)}:function(e,t,i,s){void 0===s&&(s=i),e[s]=t[i]}),o=this&&this.__exportStar||function(e,t){for(var i in e)"default"===i||Object.prototype.hasOwnProperty.call(t,i)||s(t,e,i)};Object.defineProperty(t,"__esModule",{value:!0}),o(i(38),t)}},t={};return function i(s){var o=t[s];if(void 0!==o)return o.exports;var n=t[s]={exports:{}};return e[s].call(n.exports,n,n.exports,i),n.exports}(607)})())); |
@@ -11,6 +11,8 @@ import { AudioVisualizer } from "./audio-visualizer.model"; | ||
private inputStream?; | ||
private closeWebsocketOnNextFinal; | ||
private EOSsent; | ||
private readonly timeSlice; | ||
private readonly channelCount; | ||
private readonly mimeType; | ||
private readonly eosTimeoutMs; | ||
private readonly isDebug; | ||
private readonly url; | ||
@@ -39,6 +41,7 @@ private readonly visualizerConfigBase; | ||
/** | ||
* Usefull method when recording stopped, but want to wait for final result. | ||
* Usefull method when recording stopped, but want to wait for final result. Note that this method takes in account configured eos timeout. | ||
*/ | ||
private sendEndOfStream; | ||
private sendMessageIfSocketOpen; | ||
private debug; | ||
} |
@@ -10,2 +10,10 @@ import { RecognitionStatus } from "../enums"; | ||
/** | ||
* Timeout before sending EOS message. Usually not necessary to configure it, but there might be cases when you want to wait some time before sending eos message. | ||
*/ | ||
eosTimeoutMs?: number; | ||
/** | ||
* Enable debug mode to get extra messages; | ||
*/ | ||
debug?: boolean; | ||
/** | ||
* Callback for handling recognized speech. | ||
@@ -12,0 +20,0 @@ */ |
@@ -6,2 +6,7 @@ import { RecognitionStatus } from "../enums"; | ||
result?: SpeechRecognitionResult | null; | ||
adaptation_state?: { | ||
value: string; | ||
type: string; | ||
time: string; | ||
}; | ||
} |
{ | ||
"name": "@tilde-nlp/asr-api-client", | ||
"version": "2.0.6", | ||
"version": "2.0.7", | ||
"description": "Library with services for communicating with Tilde TSP platform", | ||
@@ -5,0 +5,0 @@ "private": false, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 1 instance in 1 package
25528
142