uneeq-js 2.47.3 → 2.47.5
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/api.d.ts +1 -1
- package/dist/src/service/speech-handler.d.ts +3 -0
- package/dist/umd/index.js +41 -14
- package/package.json +1 -1
- package/readme.md +7 -1
|
@@ -23,7 +23,7 @@ export declare class API {
|
|
|
23
23
|
avatarAsk(text: string): Promise<void>;
|
|
24
24
|
avatarStartRecording(): Promise<void>;
|
|
25
25
|
avatarStopRecording(): Promise<void>;
|
|
26
|
-
|
|
26
|
+
stopSpeaking(): Promise<void>;
|
|
27
27
|
getAvailableAvatarCount(): Promise<AvatarAvailableCountResponse>;
|
|
28
28
|
startSessionWithToken(data: NewSessionRequest): Promise<NewSessionResponse>;
|
|
29
29
|
setAvatarDebug(enabled: boolean): Promise<any>;
|
|
@@ -9,8 +9,11 @@ export declare class SpeechHandler {
|
|
|
9
9
|
private recordingLive;
|
|
10
10
|
private headerBlob;
|
|
11
11
|
private scriptsLoadedPromise;
|
|
12
|
+
private digitalHumanSpeaking;
|
|
12
13
|
constructor(options: SpeechHandlerOptions);
|
|
14
|
+
private loadScript;
|
|
13
15
|
private loadScripts;
|
|
16
|
+
private handleAppMessages;
|
|
14
17
|
private initWebsocket;
|
|
15
18
|
private loadSavedAudioHeaders;
|
|
16
19
|
private initVoiceActivityDetection;
|
package/dist/umd/index.js
CHANGED
|
@@ -3900,7 +3900,7 @@ class Uneeq {
|
|
|
3900
3900
|
* When successful a corresponding AvatarRequestCompleted should be received.
|
|
3901
3901
|
*/
|
|
3902
3902
|
stopSpeaking() {
|
|
3903
|
-
return this.api.
|
|
3903
|
+
return this.api.stopSpeaking();
|
|
3904
3904
|
}
|
|
3905
3905
|
/**
|
|
3906
3906
|
* Pauses a live session. Local video and audio will stop being sent and remote avatar video audio will be stopped.
|
|
@@ -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.5","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 */
|
|
@@ -13293,7 +13293,7 @@ class API {
|
|
|
13293
13293
|
avatarStopRecording() {
|
|
13294
13294
|
return this.postRequest('/api/v1/avatar/' + this._callId + '/audioCapture/stop');
|
|
13295
13295
|
}
|
|
13296
|
-
|
|
13296
|
+
stopSpeaking() {
|
|
13297
13297
|
return this.postRequest('/api/v1/avatar/' + this._callId + '/stopSpeaking');
|
|
13298
13298
|
}
|
|
13299
13299
|
getAvailableAvatarCount() {
|
|
@@ -51174,24 +51174,47 @@ 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.
|
|
51177
|
+
this.digitalHumanSpeaking = false;
|
|
51178
51178
|
console.warn('UneeQ: SPEECH_RECOGNITION input mode is in development, you may experience issues.');
|
|
51179
51179
|
this.options.assetBasePath = this.options.assetBasePath || defaultAssetPath;
|
|
51180
51180
|
this.loadSavedAudioHeaders();
|
|
51181
51181
|
this.loadScripts();
|
|
51182
51182
|
this.initWebsocket(this.options);
|
|
51183
|
+
this.handleAppMessages();
|
|
51184
|
+
}
|
|
51185
|
+
loadScript(url) {
|
|
51186
|
+
return new Promise((resolve) => {
|
|
51187
|
+
const script = document.createElement('script');
|
|
51188
|
+
script.src = url;
|
|
51189
|
+
script.onload = () => {
|
|
51190
|
+
resolve(null);
|
|
51191
|
+
};
|
|
51192
|
+
document.body.appendChild(script);
|
|
51193
|
+
});
|
|
51183
51194
|
}
|
|
51184
51195
|
loadScripts() {
|
|
51185
|
-
|
|
51186
|
-
|
|
51187
|
-
|
|
51188
|
-
|
|
51189
|
-
|
|
51190
|
-
|
|
51196
|
+
this.scriptsLoadedPromise = new Promise((resolve) => {
|
|
51197
|
+
// load the opus media recorder script first or there will be a race condition.
|
|
51198
|
+
this.loadScript(this.options.assetBasePath + 'OpusMediaRecorder.umd.js').then(() => {
|
|
51199
|
+
// once opus media recorder has finished loading, load the encoder worker.
|
|
51200
|
+
this.loadScript(this.options.assetBasePath + 'encoderWorker.umd.js').then(() => {
|
|
51201
|
+
resolve(null);
|
|
51202
|
+
});
|
|
51191
51203
|
});
|
|
51192
|
-
};
|
|
51193
|
-
|
|
51194
|
-
|
|
51204
|
+
});
|
|
51205
|
+
}
|
|
51206
|
+
handleAppMessages() {
|
|
51207
|
+
this.options.messages.subscribe((msg) => {
|
|
51208
|
+
switch (msg.uneeqMessageType) {
|
|
51209
|
+
case MessageTypes_1.UneeqMessageType.StartedSpeaking:
|
|
51210
|
+
this.digitalHumanSpeaking = true;
|
|
51211
|
+
break;
|
|
51212
|
+
case MessageTypes_1.UneeqMessageType.FinishedSpeaking:
|
|
51213
|
+
this.digitalHumanSpeaking = false;
|
|
51214
|
+
break;
|
|
51215
|
+
default:
|
|
51216
|
+
}
|
|
51217
|
+
});
|
|
51195
51218
|
}
|
|
51196
51219
|
initWebsocket(options) {
|
|
51197
51220
|
let connectionUrl = options.apiUrl.replace('https://api.', 'wss://speech-recognition-service.');
|
|
@@ -51313,7 +51336,7 @@ class SpeechHandler {
|
|
|
51313
51336
|
mimeType: 'audio/webm',
|
|
51314
51337
|
audioBitsPerSecond: audioSampleRate
|
|
51315
51338
|
};
|
|
51316
|
-
|
|
51339
|
+
this.scriptsLoadedPromise.then(() => {
|
|
51317
51340
|
this.mediaRecorder = this.getMediaRecorder(stream, mediaOptions, workerOptions);
|
|
51318
51341
|
this.mediaRecorder.ondataavailable = (e) => this.mediaRecorderOnData(e);
|
|
51319
51342
|
this.mediaRecorder.onstop = () => this.sendStopMessage();
|
|
@@ -51335,6 +51358,10 @@ class SpeechHandler {
|
|
|
51335
51358
|
if (result.final) {
|
|
51336
51359
|
this.options.api.avatarAsk(result.transcript);
|
|
51337
51360
|
}
|
|
51361
|
+
else if (this.digitalHumanSpeaking) {
|
|
51362
|
+
this.options.api.stopSpeaking();
|
|
51363
|
+
this.digitalHumanSpeaking = false;
|
|
51364
|
+
}
|
|
51338
51365
|
this.options.messages.next(new MessageTypes_1.SpeechTranscriptionMessage(result));
|
|
51339
51366
|
}
|
|
51340
51367
|
}
|
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -8,8 +8,14 @@ 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.5
|
|
12
|
+
* Speech Recognition mode: Stop the digital human from speaking when an interim speech result is received.
|
|
13
|
+
|
|
14
|
+
#### 2.47.4
|
|
15
|
+
* Fixed a race condition when loading speech recognition assets
|
|
16
|
+
|
|
11
17
|
#### 2.47.3
|
|
12
|
-
Updated speech recognition scripts to be loaded in a more secure way.
|
|
18
|
+
* Updated speech recognition scripts to be loaded in a more secure way.
|
|
13
19
|
|
|
14
20
|
#### 2.47.1
|
|
15
21
|
* Updated SPEECH_RECOGNITION mode to record in opus format.
|