uneeq-js 2.47.4 → 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.
@@ -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
- avatarStopSpeaking(): Promise<void>;
26
+ stopSpeaking(): Promise<void>;
27
27
  getAvailableAvatarCount(): Promise<AvatarAvailableCountResponse>;
28
28
  startSessionWithToken(data: NewSessionRequest): Promise<NewSessionResponse>;
29
29
  setAvatarDebug(enabled: boolean): Promise<any>;
@@ -9,9 +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);
13
14
  private loadScript;
14
15
  private loadScripts;
16
+ private handleAppMessages;
15
17
  private initWebsocket;
16
18
  private loadSavedAudioHeaders;
17
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.avatarStopSpeaking();
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.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"}}');
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
- avatarStopSpeaking() {
13296
+ stopSpeaking() {
13297
13297
  return this.postRequest('/api/v1/avatar/' + this._callId + '/stopSpeaking');
13298
13298
  }
13299
13299
  getAvailableAvatarCount() {
@@ -51174,11 +51174,13 @@ 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.digitalHumanSpeaking = false;
51177
51178
  console.warn('UneeQ: SPEECH_RECOGNITION input mode is in development, you may experience issues.');
51178
51179
  this.options.assetBasePath = this.options.assetBasePath || defaultAssetPath;
51179
51180
  this.loadSavedAudioHeaders();
51180
51181
  this.loadScripts();
51181
51182
  this.initWebsocket(this.options);
51183
+ this.handleAppMessages();
51182
51184
  }
51183
51185
  loadScript(url) {
51184
51186
  return new Promise((resolve) => {
@@ -51201,6 +51203,19 @@ class SpeechHandler {
51201
51203
  });
51202
51204
  });
51203
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
+ });
51218
+ }
51204
51219
  initWebsocket(options) {
51205
51220
  let connectionUrl = options.apiUrl.replace('https://api.', 'wss://speech-recognition-service.');
51206
51221
  connectionUrl += '/ws/recognize?session_id=' + options.sessionId;
@@ -51343,6 +51358,10 @@ class SpeechHandler {
51343
51358
  if (result.final) {
51344
51359
  this.options.api.avatarAsk(result.transcript);
51345
51360
  }
51361
+ else if (this.digitalHumanSpeaking) {
51362
+ this.options.api.stopSpeaking();
51363
+ this.digitalHumanSpeaking = false;
51364
+ }
51346
51365
  this.options.messages.next(new MessageTypes_1.SpeechTranscriptionMessage(result));
51347
51366
  }
51348
51367
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "uneeq-js",
3
- "version": "2.47.4",
3
+ "version": "2.47.5",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/src/index.d.ts",
package/readme.md CHANGED
@@ -8,6 +8,9 @@ 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
+
11
14
  #### 2.47.4
12
15
  * Fixed a race condition when loading speech recognition assets
13
16