uneeq-js 2.42.2 → 2.43.0

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.
@@ -1,9 +1,10 @@
1
1
  import { Subject } from 'rxjs';
2
2
  export declare class DigitalHumanVideoPlayManager {
3
3
  private messages;
4
+ private publicUnmuteDigitalHumanMethod;
4
5
  private video;
5
6
  private remoteVideoPlayCount;
6
- constructor(messages: Subject<any>);
7
+ constructor(messages: Subject<any>, publicUnmuteDigitalHumanMethod: () => void);
7
8
  play(video: HTMLVideoElement): void;
8
9
  unmuteVideo(): void;
9
10
  private playRemoteVideo;
@@ -16,11 +16,13 @@ export declare class VoiceInputManager {
16
16
  private digitalHumanSpeaking;
17
17
  private recording;
18
18
  private silenceTimeout?;
19
+ private stream?;
19
20
  constructor(options: UneeqOptions, api: API, messages: Subject<any>, enableMicrophone: (enabled: boolean) => void);
20
21
  setVoiceInputMode(mode: VoiceInputMode | string): void;
21
22
  startRecording(): void;
22
23
  stopRecording(): void;
23
24
  handleSessionEnd(): void;
25
+ resumeAudioContext(): void;
24
26
  initMicActivity(stream: MediaStream): void;
25
27
  private audioContextNotSupported;
26
28
  private handleAppMessages;
@@ -1,3 +1,5 @@
1
1
  export interface PersonaStartRequest {
2
2
  enableTransparentBackground?: boolean;
3
+ backgroundImageUrl?: string;
4
+ nameTagImageUrl?: string;
3
5
  }
@@ -53,4 +53,12 @@ export interface UneeqOptions {
53
53
  * This option specifies what the default voice input mode will be.
54
54
  */
55
55
  voiceInputMode: VoiceInputMode | string;
56
+ /**
57
+ * This option specifies the URL of the background image to be used when the digital human is rendered.
58
+ */
59
+ backgroundImageUrl?: string;
60
+ /**
61
+ * This option specifies the URL of the name tag image to be used when the digital human is rendered.
62
+ */
63
+ nameTagImageUrl?: string;
56
64
  }
@@ -27,6 +27,7 @@ export declare class Uneeq {
27
27
  private availableResponseTime;
28
28
  private streamManager;
29
29
  constructor(options: UneeqOptions);
30
+ setLoggerEnabled(enabled: boolean): void;
30
31
  /**
31
32
  * Initialise the session. ReadyMessage will be sent when init is ready.
32
33
  */
package/dist/umd/index.js CHANGED
@@ -5774,7 +5774,6 @@ class Uneeq {
5774
5774
  this.version = package_json_1.default.version;
5775
5775
  this.messages = new rxjs_1.Subject();
5776
5776
  this.internalMessages$ = new rxjs_1.Subject();
5777
- this.dhVideoPlayManager = new digital_human_video_play_manager_1.DigitalHumanVideoPlayManager(this.messages);
5778
5777
  this.sessionPaused = false;
5779
5778
  this.sessionStarted = false; /* Whether the user is live in a session with an avatar (different from sessionPaused) */
5780
5779
  this.unavailableAvatarMsgSent = false;
@@ -5786,6 +5785,8 @@ class Uneeq {
5786
5785
  this.options.sendLocalAudio = options.sendLocalAudio === undefined ? true : options.sendLocalAudio;
5787
5786
  this.options.enableClientPerformanceMessage = options.enableClientPerformanceMessage || false;
5788
5787
  this.options.enableTransparentBackground = options.enableTransparentBackground || false;
5788
+ this.options.backgroundImageUrl = options.backgroundImageUrl || '';
5789
+ this.options.nameTagImageUrl = options.nameTagImageUrl || '';
5789
5790
  // TODO update default mode to VOICE_ACTIVITY once we are confident in the solution.
5790
5791
  this.options.voiceInputMode = options.voiceInputMode || VoiceInputMode_1.VoiceInputMode.PUSH_TO_TALK;
5791
5792
  this.api = new api_1.API(this.options.url, this.options.apiKey);
@@ -5804,6 +5805,11 @@ class Uneeq {
5804
5805
  logger_1.logger.log(`Uneeq Created (version ${this.version})`);
5805
5806
  this.streamManager = new stream_manager_1.StreamManager();
5806
5807
  this.metricsService = new metrics_service_1.MetricsService(this.options, this.internalMessages$, this.messages);
5808
+ this.dhVideoPlayManager = new digital_human_video_play_manager_1.DigitalHumanVideoPlayManager(this.messages, () => { this.unmuteDigitalHuman(); });
5809
+ }
5810
+ /* Enable or disable logging */
5811
+ setLoggerEnabled(enabled) {
5812
+ logger_1.logger.enabled = enabled;
5807
5813
  }
5808
5814
  /**
5809
5815
  * Initialise the session. ReadyMessage will be sent when init is ready.
@@ -6024,6 +6030,7 @@ class Uneeq {
6024
6030
  }
6025
6031
  /* Unmute the digital human video - this might be called if the video started in muted mode.*/
6026
6032
  unmuteDigitalHuman() {
6033
+ this.voiceInputManager.resumeAudioContext();
6027
6034
  this.dhVideoPlayManager.unmuteVideo();
6028
6035
  }
6029
6036
  gatherWebRtcMetrics() {
@@ -6092,7 +6099,6 @@ class Uneeq {
6092
6099
  .filter((message) => message.faceMeMessageType === 'DevicePermissionAllowedInternal')
6093
6100
  .pipe(operators_1.take(1))
6094
6101
  .subscribe((msg) => {
6095
- console.log('DevicePermissionAllowedInternal');
6096
6102
  this.messages.next(new MessageTypes_1.DevicePermissionAllowedMessage());
6097
6103
  this.startAvatarWhenAvailable();
6098
6104
  });
@@ -6128,7 +6134,11 @@ class Uneeq {
6128
6134
  };
6129
6135
  this.internalMessages$.next({ faceMeMessageType: 'prom', promMsg: availabilityChkMetric });
6130
6136
  this.messages.next(new MessageTypes_1.AvatarAvailableMessage());
6131
- this.api.avatarStart({ enableTransparentBackground: this.options.enableTransparentBackground });
6137
+ this.api.avatarStart({
6138
+ enableTransparentBackground: this.options.enableTransparentBackground,
6139
+ backgroundImageUrl: this.options.backgroundImageUrl,
6140
+ nameTagImageUrl: this.options.nameTagImageUrl
6141
+ });
6132
6142
  }
6133
6143
  else {
6134
6144
  if (!this.unavailableAvatarMsgSent) {
@@ -18106,7 +18116,7 @@ function zipAll(project) {
18106
18116
  /* 224 */
18107
18117
  /***/ (function(module) {
18108
18118
 
18109
- module.exports = JSON.parse("{\"name\":\"uneeq-js\",\"version\":\"2.42.2\",\"description\":\"\",\"main\":\"dist/index.js\",\"types\":\"dist/src/index.d.ts\",\"scripts\":{\"start\":\"npx webpack -w\",\"test-local\":\"./node_modules/karma/bin/karma start karma.conf.js -logLevel=DEBUG\",\"test\":\"./node_modules/karma/bin/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\":\"./node_modules/tslint/bin/tslint -p tsconfig.json --fix\",\"docs\":\"./node_modules/typedoc/bin/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\",\"promjs\":\"^0.4.1\",\"rxjs\":\"^6.2.2\",\"rxjs-compat\":\"^6.3.2\",\"simple-peer\":\"9.11.0\",\"webrtc-adapter\":\"8.1.0\"},\"devDependencies\":{\"@types/jasmine\":\"^2.8.8\",\"@types/node\":\"^10.9.4\",\"fetch-mock\":\"7.7.3\",\"ignore-styles\":\"^5.0.1\",\"jasmine\":\"^3.2.0\",\"jasmine-class-mock\":\"^1.0.1\",\"jasmine-core\":\"^3.3.0\",\"karma\":\"^5.0.0\",\"karma-chrome-launcher\":\"^2.2.0\",\"karma-firefox-launcher\":\"^1.1.0\",\"karma-jasmine\":\"^2.0.1\",\"karma-jasmine-html-reporter\":\"^1.4.0\",\"karma-requirejs\":\"^1.1.0\",\"karma-safari-launcher\":\"^1.0.0\",\"karma-typescript\":\"^5.0.0\",\"karma-typescript-es6-transform\":\"^5.0.0\",\"nock\":\"^9.6.1\",\"requirejs\":\"^2.3.6\",\"ts-loader\":\"^5.0.0\",\"ts-node\":\"^7.0.1\",\"tslint\":\"^5.11.0\",\"tslint-no-focused-test\":\"^0.5.0\",\"typedoc\":\"^0.18.0\",\"typescript\":\"^3.9.7\",\"webpack\":\"^4.17.1\",\"webpack-cli\":\"^3.1.0\"}}");
18119
+ module.exports = JSON.parse("{\"name\":\"uneeq-js\",\"version\":\"2.43.0\",\"description\":\"\",\"main\":\"dist/index.js\",\"types\":\"dist/src/index.d.ts\",\"scripts\":{\"start\":\"npx webpack -w\",\"test-local\":\"./node_modules/karma/bin/karma start karma.conf.js -logLevel=DEBUG\",\"test\":\"./node_modules/karma/bin/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\":\"./node_modules/tslint/bin/tslint -p tsconfig.json --fix\",\"docs\":\"./node_modules/typedoc/bin/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\",\"promjs\":\"^0.4.1\",\"rxjs\":\"^6.2.2\",\"rxjs-compat\":\"^6.3.2\",\"simple-peer\":\"9.11.0\",\"webrtc-adapter\":\"8.1.0\"},\"devDependencies\":{\"@types/jasmine\":\"^2.8.8\",\"@types/node\":\"^10.9.4\",\"fetch-mock\":\"7.7.3\",\"ignore-styles\":\"^5.0.1\",\"jasmine\":\"^3.2.0\",\"jasmine-class-mock\":\"^1.0.1\",\"jasmine-core\":\"^3.3.0\",\"karma\":\"^5.0.0\",\"karma-chrome-launcher\":\"^2.2.0\",\"karma-firefox-launcher\":\"^1.1.0\",\"karma-jasmine\":\"^2.0.1\",\"karma-jasmine-html-reporter\":\"^1.4.0\",\"karma-requirejs\":\"^1.1.0\",\"karma-safari-launcher\":\"^1.0.0\",\"karma-typescript\":\"^5.0.0\",\"karma-typescript-es6-transform\":\"^5.0.0\",\"nock\":\"^9.6.1\",\"requirejs\":\"^2.3.6\",\"ts-loader\":\"^5.0.0\",\"ts-node\":\"^7.0.1\",\"tslint\":\"^5.11.0\",\"tslint-no-focused-test\":\"^0.5.0\",\"typedoc\":\"^0.18.0\",\"typescript\":\"^3.9.7\",\"webpack\":\"^4.17.1\",\"webpack-cli\":\"^3.1.0\"}}");
18110
18120
 
18111
18121
  /***/ }),
18112
18122
  /* 225 */
@@ -32300,8 +32310,9 @@ exports.DigitalHumanVideoPlayManager = void 0;
32300
32310
  const MessageTypes_1 = __webpack_require__(267);
32301
32311
  const logger_1 = __webpack_require__(233);
32302
32312
  class DigitalHumanVideoPlayManager {
32303
- constructor(messages) {
32313
+ constructor(messages, publicUnmuteDigitalHumanMethod) {
32304
32314
  this.messages = messages;
32315
+ this.publicUnmuteDigitalHumanMethod = publicUnmuteDigitalHumanMethod;
32305
32316
  // Used to track the number of attempts to re-play the DH video (Safari 15+ stream not visible)
32306
32317
  this.remoteVideoPlayCount = 0;
32307
32318
  }
@@ -32319,9 +32330,9 @@ class DigitalHumanVideoPlayManager {
32319
32330
  // Play the digital human video when session is live (i.e. video and audio streaming in both directions)
32320
32331
  if (this.video) {
32321
32332
  /*
32322
- Note: do not set autplay = true, or safari will handle the play() differently to Chrome
32333
+ Note: do not set autoplay = true, or safari will handle the play() differently to Chrome
32323
32334
  When autoplay is set to true Safari will automatically try to play the video as muted. This
32324
- causes the second play as muted behaviour to fail and fall in our catch block. The consequence
32335
+ causes the second play as muted behavior to fail and fall in our catch block. The consequence
32325
32336
  is that the DigitalHumanPlayedInMutedModeSuccess is not sent. tldr; do not set autoplay = true
32326
32337
  */
32327
32338
  // Catch general video errors and video unmute errors
@@ -32337,7 +32348,7 @@ class DigitalHumanVideoPlayManager {
32337
32348
  logger_1.logger.log('Muting the digital human and playing it succeeded.');
32338
32349
  // video did play once it was muted.
32339
32350
  this.messages.next(new MessageTypes_1.DigitalHumanPlayedInMutedModeSuccess());
32340
- this.video.addEventListener('click', () => { this.unmuteVideo(); }, { once: true });
32351
+ this.video.addEventListener('click', () => { this.publicUnmuteDigitalHumanMethod(); }, { once: true });
32341
32352
  })
32342
32353
  .catch((err) => {
32343
32354
  logger_1.logger.log('Could not play digital human video even as muted, starting exponential backoff.', err);
@@ -53423,6 +53434,7 @@ const operators_1 = __webpack_require__(126);
53423
53434
  const soundmeter_1 = __webpack_require__(307);
53424
53435
  const MessageTypes_1 = __webpack_require__(267);
53425
53436
  const VoiceInputMode_1 = __webpack_require__(308);
53437
+ const logger_1 = __webpack_require__(233);
53426
53438
  class VoiceInputManager {
53427
53439
  constructor(options, api, messages, enableMicrophone) {
53428
53440
  this.options = options;
@@ -53483,7 +53495,18 @@ class VoiceInputManager {
53483
53495
  this.soundMeter.stop();
53484
53496
  }
53485
53497
  }
53498
+ /* If the publish audio context is resumed, we want to re-init the mic activity monitoring */
53499
+ resumeAudioContext() {
53500
+ logger_1.logger.log('UneeQ: resuming publish stream audio context and initializing mic activity.');
53501
+ if (this.audioContext) {
53502
+ this.audioContext.resume();
53503
+ if (this.stream) {
53504
+ this.initMicActivity(this.stream);
53505
+ }
53506
+ }
53507
+ }
53486
53508
  initMicActivity(stream) {
53509
+ this.stream = stream;
53487
53510
  this.soundMeter = new soundmeter_1.SoundMeter(this.audioContext);
53488
53511
  this.soundMeter.connectToSource(stream, (e) => this.micActivityConnected(e));
53489
53512
  }
@@ -53498,6 +53521,7 @@ class VoiceInputManager {
53498
53521
  this.messages.subscribe((msg) => {
53499
53522
  switch (msg.uneeqMessageType) {
53500
53523
  case MessageTypes_1.UneeqMessageType.StartedSpeaking:
53524
+ console.log('StartSpeaking message');
53501
53525
  this.digitalHumanSpeaking = true;
53502
53526
  break;
53503
53527
  case MessageTypes_1.UneeqMessageType.FinishedSpeaking:
@@ -53555,7 +53579,7 @@ class VoiceInputManager {
53555
53579
  // Run Volume Activity detection process
53556
53580
  if (this.options.voiceInputMode === VoiceInputMode_1.VoiceInputMode.VOICE_ACTIVITY &&
53557
53581
  (!this.digitalHumanSpeaking || this.voiceActivityAllowInterruptions)) {
53558
- // possible improvement: system could wait to get multiple activty messages above threshold before starting recording
53582
+ // possible improvement: system could wait to get multiple activity messages above threshold before starting recording
53559
53583
  if (level > this.microphoneEngageVolume) {
53560
53584
  if (!this.recording) {
53561
53585
  this.apiStartRecording();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "uneeq-js",
3
- "version": "2.42.2",
3
+ "version": "2.43.0",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/src/index.d.ts",
package/readme.md CHANGED
@@ -8,6 +8,12 @@ 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.43.0
12
+ * Adding support for setting a background image and name tag image when starting a session using new fields in UneeqOptions. Url restrictions apply, please reach out to the Customer Service team.
13
+
14
+ #### 2.42.3
15
+ * Fixed issue that caused voiceActivity input not to work when using autoStart
16
+
11
17
  #### 2.42.2
12
18
  * Improved responsiveness of RecordingStartedMessage when using VOICE_ACTIVITY input mode.
13
19