uneeq-js 2.47.3 → 2.47.4
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.js +1 -1
- package/dist/src/service/speech-handler.d.ts +1 -0
- package/dist/umd/index.js +20 -12
- package/package.json +1 -1
- package/readme.md +4 -1
package/dist/umd/index.js
CHANGED
|
@@ -13240,7 +13240,7 @@ exports.race = race;
|
|
|
13240
13240
|
/***/ ((module) => {
|
|
13241
13241
|
|
|
13242
13242
|
"use strict";
|
|
13243
|
-
module.exports = JSON.parse('{"name":"uneeq-js","version":"2.47.
|
|
13243
|
+
module.exports = JSON.parse('{"name":"uneeq-js","version":"2.47.4","description":"","main":"dist/index.js","types":"dist/src/index.d.ts","scripts":{"start":"npx webpack -w","test-local":"npx karma start karma.conf.js -logLevel=DEBUG","test":"npx karma start --browsers ChromeHeadless --single-run","test:windows":"karma start karma.conf.js","build":"webpack --config webpack.config.prod.js && webpack --config webpack.config.umd.js","lint":"npx tslint -p tsconfig.json --fix","docs":"npx typedoc --options"},"files":["dist","!dist/test"],"author":"","license":"ISC","dependencies":{"@stomp/stompjs":"^6.0.0","@uehreka/seriously":"^1.0.1","fast-text-encoding":"^1.0.0","intrinsic-scale":"^3.0.4","onnxruntime-web":"^1.15.1","promjs":"^0.4.1","ring-buffer-ts":"^1.2.0","rxjs":"^7.8.1","rxjs-compat":"^6.6.7","simple-peer":"^9.11.1","webrtc-adapter":"^8.2.3"},"devDependencies":{"@types/dom-mediacapture-record":"^1.0.16","@types/jasmine":"^2.8.8","@types/node":"^10.9.4","fetch-mock":"7.7.3","ignore-styles":"^5.0.1","jasmine":"^5.1.0","jasmine-core":"^5.1.0","karma":"^6.4.2","karma-chrome-launcher":"^3.2.0","karma-firefox-launcher":"^2.1.2","karma-jasmine":"^5.1.0","karma-jasmine-html-reporter":"^2.1.0","karma-requirejs":"^1.1.0","karma-typescript":"^5.5.4","karma-typescript-es6-transform":"^5.5.4","nock":"^9.6.1","requirejs":"^2.3.6","ts-loader":"^9.4.4","ts-node":"^7.0.1","tslint":"^5.11.0","tslint-no-focused-test":"^0.5.0","typedoc":"^0.18.0","typescript":"^5.1.6","webpack":"^5.88.2","webpack-cli":"^5.1.4"}}');
|
|
13244
13244
|
|
|
13245
13245
|
/***/ }),
|
|
13246
13246
|
/* 242 */
|
|
@@ -51174,24 +51174,32 @@ class SpeechHandler {
|
|
|
51174
51174
|
this.logPrefix = 'UneeQ: Speech Recognition: ';
|
|
51175
51175
|
this.speechBuffer = new ring_buffer_ts_1.RingBuffer(speechBufferLength);
|
|
51176
51176
|
this.recordingLive = false;
|
|
51177
|
-
this.scriptsLoadedPromise = [];
|
|
51178
51177
|
console.warn('UneeQ: SPEECH_RECOGNITION input mode is in development, you may experience issues.');
|
|
51179
51178
|
this.options.assetBasePath = this.options.assetBasePath || defaultAssetPath;
|
|
51180
51179
|
this.loadSavedAudioHeaders();
|
|
51181
51180
|
this.loadScripts();
|
|
51182
51181
|
this.initWebsocket(this.options);
|
|
51183
51182
|
}
|
|
51183
|
+
loadScript(url) {
|
|
51184
|
+
return new Promise((resolve) => {
|
|
51185
|
+
const script = document.createElement('script');
|
|
51186
|
+
script.src = url;
|
|
51187
|
+
script.onload = () => {
|
|
51188
|
+
resolve(null);
|
|
51189
|
+
};
|
|
51190
|
+
document.body.appendChild(script);
|
|
51191
|
+
});
|
|
51192
|
+
}
|
|
51184
51193
|
loadScripts() {
|
|
51185
|
-
|
|
51186
|
-
|
|
51187
|
-
|
|
51188
|
-
|
|
51189
|
-
|
|
51190
|
-
|
|
51194
|
+
this.scriptsLoadedPromise = new Promise((resolve) => {
|
|
51195
|
+
// load the opus media recorder script first or there will be a race condition.
|
|
51196
|
+
this.loadScript(this.options.assetBasePath + 'OpusMediaRecorder.umd.js').then(() => {
|
|
51197
|
+
// once opus media recorder has finished loading, load the encoder worker.
|
|
51198
|
+
this.loadScript(this.options.assetBasePath + 'encoderWorker.umd.js').then(() => {
|
|
51199
|
+
resolve(null);
|
|
51200
|
+
});
|
|
51191
51201
|
});
|
|
51192
|
-
};
|
|
51193
|
-
this.scriptsLoadedPromise.push(loadScript(this.options.assetBasePath + 'OpusMediaRecorder.umd.js'));
|
|
51194
|
-
this.scriptsLoadedPromise.push(loadScript(this.options.assetBasePath + 'encoderWorker.umd.js'));
|
|
51202
|
+
});
|
|
51195
51203
|
}
|
|
51196
51204
|
initWebsocket(options) {
|
|
51197
51205
|
let connectionUrl = options.apiUrl.replace('https://api.', 'wss://speech-recognition-service.');
|
|
@@ -51313,7 +51321,7 @@ class SpeechHandler {
|
|
|
51313
51321
|
mimeType: 'audio/webm',
|
|
51314
51322
|
audioBitsPerSecond: audioSampleRate
|
|
51315
51323
|
};
|
|
51316
|
-
|
|
51324
|
+
this.scriptsLoadedPromise.then(() => {
|
|
51317
51325
|
this.mediaRecorder = this.getMediaRecorder(stream, mediaOptions, workerOptions);
|
|
51318
51326
|
this.mediaRecorder.ondataavailable = (e) => this.mediaRecorderOnData(e);
|
|
51319
51327
|
this.mediaRecorder.onstop = () => this.sendStopMessage();
|
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -8,8 +8,11 @@ https://docs.uneeq.io/build-your-own-experience
|
|
|
8
8
|
To use uneeq-js with a typescript version < 3.8, 'skipLibCheck' must be set to true.
|
|
9
9
|
|
|
10
10
|
## Release Notes
|
|
11
|
+
#### 2.47.4
|
|
12
|
+
* Fixed a race condition when loading speech recognition assets
|
|
13
|
+
|
|
11
14
|
#### 2.47.3
|
|
12
|
-
Updated speech recognition scripts to be loaded in a more secure way.
|
|
15
|
+
* Updated speech recognition scripts to be loaded in a more secure way.
|
|
13
16
|
|
|
14
17
|
#### 2.47.1
|
|
15
18
|
* Updated SPEECH_RECOGNITION mode to record in opus format.
|