uneeq-js 2.42.2 → 2.42.3
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;
|
package/dist/src/uneeq.d.ts
CHANGED
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;
|
|
@@ -5804,6 +5803,11 @@ class Uneeq {
|
|
|
5804
5803
|
logger_1.logger.log(`Uneeq Created (version ${this.version})`);
|
|
5805
5804
|
this.streamManager = new stream_manager_1.StreamManager();
|
|
5806
5805
|
this.metricsService = new metrics_service_1.MetricsService(this.options, this.internalMessages$, this.messages);
|
|
5806
|
+
this.dhVideoPlayManager = new digital_human_video_play_manager_1.DigitalHumanVideoPlayManager(this.messages, () => { this.unmuteDigitalHuman(); });
|
|
5807
|
+
}
|
|
5808
|
+
/* Enable or disable logging */
|
|
5809
|
+
setLoggerEnabled(enabled) {
|
|
5810
|
+
logger_1.logger.enabled = enabled;
|
|
5807
5811
|
}
|
|
5808
5812
|
/**
|
|
5809
5813
|
* Initialise the session. ReadyMessage will be sent when init is ready.
|
|
@@ -6024,6 +6028,7 @@ class Uneeq {
|
|
|
6024
6028
|
}
|
|
6025
6029
|
/* Unmute the digital human video - this might be called if the video started in muted mode.*/
|
|
6026
6030
|
unmuteDigitalHuman() {
|
|
6031
|
+
this.voiceInputManager.resumeAudioContext();
|
|
6027
6032
|
this.dhVideoPlayManager.unmuteVideo();
|
|
6028
6033
|
}
|
|
6029
6034
|
gatherWebRtcMetrics() {
|
|
@@ -6092,7 +6097,6 @@ class Uneeq {
|
|
|
6092
6097
|
.filter((message) => message.faceMeMessageType === 'DevicePermissionAllowedInternal')
|
|
6093
6098
|
.pipe(operators_1.take(1))
|
|
6094
6099
|
.subscribe((msg) => {
|
|
6095
|
-
console.log('DevicePermissionAllowedInternal');
|
|
6096
6100
|
this.messages.next(new MessageTypes_1.DevicePermissionAllowedMessage());
|
|
6097
6101
|
this.startAvatarWhenAvailable();
|
|
6098
6102
|
});
|
|
@@ -18106,7 +18110,7 @@ function zipAll(project) {
|
|
|
18106
18110
|
/* 224 */
|
|
18107
18111
|
/***/ (function(module) {
|
|
18108
18112
|
|
|
18109
|
-
module.exports = JSON.parse("{\"name\":\"uneeq-js\",\"version\":\"2.42.
|
|
18113
|
+
module.exports = JSON.parse("{\"name\":\"uneeq-js\",\"version\":\"2.42.3\",\"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
18114
|
|
|
18111
18115
|
/***/ }),
|
|
18112
18116
|
/* 225 */
|
|
@@ -32300,8 +32304,9 @@ exports.DigitalHumanVideoPlayManager = void 0;
|
|
|
32300
32304
|
const MessageTypes_1 = __webpack_require__(267);
|
|
32301
32305
|
const logger_1 = __webpack_require__(233);
|
|
32302
32306
|
class DigitalHumanVideoPlayManager {
|
|
32303
|
-
constructor(messages) {
|
|
32307
|
+
constructor(messages, publicUnmuteDigitalHumanMethod) {
|
|
32304
32308
|
this.messages = messages;
|
|
32309
|
+
this.publicUnmuteDigitalHumanMethod = publicUnmuteDigitalHumanMethod;
|
|
32305
32310
|
// Used to track the number of attempts to re-play the DH video (Safari 15+ stream not visible)
|
|
32306
32311
|
this.remoteVideoPlayCount = 0;
|
|
32307
32312
|
}
|
|
@@ -32319,9 +32324,9 @@ class DigitalHumanVideoPlayManager {
|
|
|
32319
32324
|
// Play the digital human video when session is live (i.e. video and audio streaming in both directions)
|
|
32320
32325
|
if (this.video) {
|
|
32321
32326
|
/*
|
|
32322
|
-
Note: do not set
|
|
32327
|
+
Note: do not set autoplay = true, or safari will handle the play() differently to Chrome
|
|
32323
32328
|
When autoplay is set to true Safari will automatically try to play the video as muted. This
|
|
32324
|
-
causes the second play as muted
|
|
32329
|
+
causes the second play as muted behavior to fail and fall in our catch block. The consequence
|
|
32325
32330
|
is that the DigitalHumanPlayedInMutedModeSuccess is not sent. tldr; do not set autoplay = true
|
|
32326
32331
|
*/
|
|
32327
32332
|
// Catch general video errors and video unmute errors
|
|
@@ -32337,7 +32342,7 @@ class DigitalHumanVideoPlayManager {
|
|
|
32337
32342
|
logger_1.logger.log('Muting the digital human and playing it succeeded.');
|
|
32338
32343
|
// video did play once it was muted.
|
|
32339
32344
|
this.messages.next(new MessageTypes_1.DigitalHumanPlayedInMutedModeSuccess());
|
|
32340
|
-
this.video.addEventListener('click', () => { this.
|
|
32345
|
+
this.video.addEventListener('click', () => { this.publicUnmuteDigitalHumanMethod(); }, { once: true });
|
|
32341
32346
|
})
|
|
32342
32347
|
.catch((err) => {
|
|
32343
32348
|
logger_1.logger.log('Could not play digital human video even as muted, starting exponential backoff.', err);
|
|
@@ -53423,6 +53428,7 @@ const operators_1 = __webpack_require__(126);
|
|
|
53423
53428
|
const soundmeter_1 = __webpack_require__(307);
|
|
53424
53429
|
const MessageTypes_1 = __webpack_require__(267);
|
|
53425
53430
|
const VoiceInputMode_1 = __webpack_require__(308);
|
|
53431
|
+
const logger_1 = __webpack_require__(233);
|
|
53426
53432
|
class VoiceInputManager {
|
|
53427
53433
|
constructor(options, api, messages, enableMicrophone) {
|
|
53428
53434
|
this.options = options;
|
|
@@ -53483,7 +53489,18 @@ class VoiceInputManager {
|
|
|
53483
53489
|
this.soundMeter.stop();
|
|
53484
53490
|
}
|
|
53485
53491
|
}
|
|
53492
|
+
/* If the publish audio context is resumed, we want to re-init the mic activity monitoring */
|
|
53493
|
+
resumeAudioContext() {
|
|
53494
|
+
logger_1.logger.log('UneeQ: resuming publish stream audio context and initializing mic activity.');
|
|
53495
|
+
if (this.audioContext) {
|
|
53496
|
+
this.audioContext.resume();
|
|
53497
|
+
if (this.stream) {
|
|
53498
|
+
this.initMicActivity(this.stream);
|
|
53499
|
+
}
|
|
53500
|
+
}
|
|
53501
|
+
}
|
|
53486
53502
|
initMicActivity(stream) {
|
|
53503
|
+
this.stream = stream;
|
|
53487
53504
|
this.soundMeter = new soundmeter_1.SoundMeter(this.audioContext);
|
|
53488
53505
|
this.soundMeter.connectToSource(stream, (e) => this.micActivityConnected(e));
|
|
53489
53506
|
}
|
|
@@ -53498,6 +53515,7 @@ class VoiceInputManager {
|
|
|
53498
53515
|
this.messages.subscribe((msg) => {
|
|
53499
53516
|
switch (msg.uneeqMessageType) {
|
|
53500
53517
|
case MessageTypes_1.UneeqMessageType.StartedSpeaking:
|
|
53518
|
+
console.log('StartSpeaking message');
|
|
53501
53519
|
this.digitalHumanSpeaking = true;
|
|
53502
53520
|
break;
|
|
53503
53521
|
case MessageTypes_1.UneeqMessageType.FinishedSpeaking:
|
|
@@ -53555,7 +53573,7 @@ class VoiceInputManager {
|
|
|
53555
53573
|
// Run Volume Activity detection process
|
|
53556
53574
|
if (this.options.voiceInputMode === VoiceInputMode_1.VoiceInputMode.VOICE_ACTIVITY &&
|
|
53557
53575
|
(!this.digitalHumanSpeaking || this.voiceActivityAllowInterruptions)) {
|
|
53558
|
-
// possible improvement: system could wait to get multiple
|
|
53576
|
+
// possible improvement: system could wait to get multiple activity messages above threshold before starting recording
|
|
53559
53577
|
if (level > this.microphoneEngageVolume) {
|
|
53560
53578
|
if (!this.recording) {
|
|
53561
53579
|
this.apiStartRecording();
|
package/package.json
CHANGED
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.42.3
|
|
12
|
+
* Fixed issue that caused voiceActivity input not to work when using autoStart
|
|
13
|
+
|
|
11
14
|
#### 2.42.2
|
|
12
15
|
* Improved responsiveness of RecordingStartedMessage when using VOICE_ACTIVITY input mode.
|
|
13
16
|
|