uneeq-js 2.42.1 → 2.42.2

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/umd/index.js CHANGED
@@ -126,7 +126,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
126
126
  __webpack_require__(1);
127
127
  const adapter = __importStar(__webpack_require__(7));
128
128
  const uneeq_1 = __webpack_require__(19);
129
- __exportStar(__webpack_require__(227), exports);
129
+ __exportStar(__webpack_require__(267), exports);
130
130
  var uneeq_2 = __webpack_require__(19);
131
131
  Object.defineProperty(exports, "Uneeq", { enumerable: true, get: function () { return uneeq_2.Uneeq; } });
132
132
  __exportStar(__webpack_require__(7), exports);
@@ -5753,9 +5753,9 @@ __webpack_require__(123);
5753
5753
  const operators_1 = __webpack_require__(126);
5754
5754
  const package_json_1 = __importDefault(__webpack_require__(224));
5755
5755
  const api_1 = __webpack_require__(225);
5756
- const digital_human_video_play_manager_1 = __webpack_require__(226);
5757
- const device_manager_1 = __webpack_require__(229);
5758
- const logger_1 = __webpack_require__(228);
5756
+ const device_manager_1 = __webpack_require__(226);
5757
+ const digital_human_video_play_manager_1 = __webpack_require__(266);
5758
+ const logger_1 = __webpack_require__(233);
5759
5759
  const message_handler_1 = __webpack_require__(268);
5760
5760
  const messaging_1 = __webpack_require__(280);
5761
5761
  const metrics_service_1 = __webpack_require__(302);
@@ -5763,9 +5763,9 @@ const online_status_service_1 = __webpack_require__(304);
5763
5763
  const prom_1 = __webpack_require__(269);
5764
5764
  const stream_manager_1 = __webpack_require__(305);
5765
5765
  const voice_input_manager_1 = __webpack_require__(306);
5766
- const MessageTypes_1 = __webpack_require__(227);
5766
+ const MessageTypes_1 = __webpack_require__(267);
5767
5767
  const NewSessionRequest_1 = __webpack_require__(309);
5768
- const PublishSubscribeState_1 = __webpack_require__(234);
5768
+ const PublishSubscribeState_1 = __webpack_require__(231);
5769
5769
  const SourceApp_1 = __webpack_require__(310);
5770
5770
  const VoiceInputMode_1 = __webpack_require__(308);
5771
5771
  class Uneeq {
@@ -18106,7 +18106,7 @@ function zipAll(project) {
18106
18106
  /* 224 */
18107
18107
  /***/ (function(module) {
18108
18108
 
18109
- module.exports = JSON.parse("{\"name\":\"uneeq-js\",\"version\":\"2.42.1\",\"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\"}}");
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\"}}");
18110
18110
 
18111
18111
  /***/ }),
18112
18112
  /* 225 */
@@ -18246,75 +18246,217 @@ exports.API = API;
18246
18246
 
18247
18247
  "use strict";
18248
18248
 
18249
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
18250
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
18251
+ return new (P || (P = Promise))(function (resolve, reject) {
18252
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
18253
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
18254
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
18255
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
18256
+ });
18257
+ };
18249
18258
  Object.defineProperty(exports, "__esModule", { value: true });
18250
- exports.DigitalHumanVideoPlayManager = void 0;
18251
- const MessageTypes_1 = __webpack_require__(227);
18252
- const logger_1 = __webpack_require__(228);
18253
- class DigitalHumanVideoPlayManager {
18254
- constructor(messages) {
18255
- this.messages = messages;
18256
- // Used to track the number of attempts to re-play the DH video (Safari 15+ stream not visible)
18257
- this.remoteVideoPlayCount = 0;
18259
+ exports.DeviceManager = void 0;
18260
+ const __1 = __webpack_require__(0);
18261
+ const media_handler_1 = __webpack_require__(227);
18262
+ class DeviceManager {
18263
+ constructor(options, api) {
18264
+ this.options = options;
18265
+ this.api = api;
18266
+ this.speakerConstraints = {};
18267
+ this.publishStream = new MediaStream();
18268
+ this.devices = { audioInput: [], audioOutput: [], videoInput: [] };
18269
+ this.previousMediaOptions = {};
18270
+ this.mediaHandler = new media_handler_1.MediaHandler(this.options, () => this.remoteVideoReady());
18271
+ this.initMediaConstraints();
18272
+ this.getDevices(false); // once the device list is updated the publish will be performed.
18258
18273
  }
18259
- play(video) {
18260
- this.video = video;
18261
- this.playRemoteVideo();
18274
+ set edgeNodeId(edgeNodeId) {
18275
+ this.mediaHandler.setEdgeNodeId(edgeNodeId);
18276
+ this.getDevices(true);
18262
18277
  }
18263
- unmuteVideo() {
18264
- if (this.video && this.video.muted) {
18265
- this.video.muted = false;
18266
- this.messages.next(new MessageTypes_1.DigitalHumanUnmuted());
18278
+ enableLocalDevices(sendLocalVideo, sendLocalAudio) {
18279
+ const videoOptionChanged = this.options.uneeqOptions.sendLocalVideo !== sendLocalVideo;
18280
+ const audioOptionChanged = this.options.uneeqOptions.sendLocalAudio !== sendLocalAudio;
18281
+ if (videoOptionChanged || audioOptionChanged) {
18282
+ this.previousMediaOptions = {
18283
+ sendLocalVideo: this.options.uneeqOptions.sendLocalVideo,
18284
+ sendLocalAudio: this.options.uneeqOptions.sendLocalAudio
18285
+ };
18286
+ this.options.uneeqOptions.sendLocalVideo = sendLocalVideo;
18287
+ this.options.uneeqOptions.sendLocalAudio = sendLocalAudio;
18288
+ if (videoOptionChanged && sendLocalVideo === false) {
18289
+ this.publishStream.getVideoTracks().forEach((stream) => stream.stop());
18290
+ }
18291
+ if (audioOptionChanged && sendLocalAudio === false) {
18292
+ this.publishStream.getAudioTracks().forEach((stream) => stream.stop());
18293
+ }
18294
+ this.mediaHandler.publishingStream = false;
18295
+ this.initMediaConstraints();
18296
+ this.getDevices(true);
18267
18297
  }
18268
18298
  }
18269
- playRemoteVideo() {
18270
- // Play the digital human video when session is live (i.e. video and audio streaming in both directions)
18271
- if (this.video) {
18272
- /*
18273
- Note: do not set autplay = true, or safari will handle the play() differently to Chrome
18274
- When autoplay is set to true Safari will automatically try to play the video as muted. This
18275
- causes the second play as muted behaviour to fail and fall in our catch block. The consequence
18276
- is that the DigitalHumanPlayedInMutedModeSuccess is not sent. tldr; do not set autoplay = true
18277
- */
18278
- // Catch general video errors and video unmute errors
18279
- this.video.onerror = (error) => {
18280
- this.messages.next(new MessageTypes_1.DigitalHumanVideoError(error));
18281
- };
18282
- this.video.play().catch(() => {
18283
- // video failed to play, mute video then see if it will play
18284
- this.messages.next(new MessageTypes_1.DigitalHumanFailedToPlay());
18285
- this.video.muted = true;
18286
- this.video.play()
18287
- .then(() => {
18288
- logger_1.logger.log('Muting the digital human and playing it succeeded.');
18289
- // video did play once it was muted.
18290
- this.messages.next(new MessageTypes_1.DigitalHumanPlayedInMutedModeSuccess());
18291
- this.video.addEventListener('click', () => { this.unmuteVideo(); }, { once: true });
18292
- })
18293
- .catch((err) => {
18294
- logger_1.logger.log('Could not play digital human video even as muted, starting exponential backoff.', err);
18295
- // video still could not play even when muted, let's try an exponential back off
18296
- this.playRemoteVideoWithExponentialBackoff();
18299
+ // Once the device list is updated the publish will be performed.
18300
+ getDevices(publish = true) {
18301
+ if (!this.options.uneeqOptions.sendLocalVideo && !this.options.uneeqOptions.sendLocalAudio) {
18302
+ this.initStreamWithoutDevices();
18303
+ return;
18304
+ }
18305
+ const self = this;
18306
+ this.publishStream = new MediaStream();
18307
+ this.options.streamManager.addCanvasVideoTrackToStream(this.publishStream);
18308
+ this.options.streamManager.addSilentAudioTrackToStream(this.publishStream);
18309
+ /* Get User Devices */
18310
+ navigator.mediaDevices.getUserMedia(this.userMediaConstraints)
18311
+ .then((localStream) => __awaiter(this, void 0, void 0, function* () {
18312
+ this.initDeviceList();
18313
+ this.options.internalMessages$.next({ faceMeMessageType: 'DevicePermissionAllowedInternal' });
18314
+ if (publish) {
18315
+ if (this.options.uneeqOptions.sendLocalVideo) {
18316
+ const capturedVideoTracks = localStream.getVideoTracks();
18317
+ if (capturedVideoTracks.length > 0) {
18318
+ this.publishStream.getVideoTracks().forEach((track) => this.publishStream.removeTrack(track));
18319
+ this.publishStream.addTrack(capturedVideoTracks[0]);
18320
+ }
18321
+ }
18322
+ if (this.options.uneeqOptions.sendLocalAudio) {
18323
+ const capturedAudioTracks = localStream.getAudioTracks();
18324
+ if (capturedAudioTracks.length > 0) {
18325
+ this.publishStream.getAudioTracks().forEach((track) => this.publishStream.removeTrack(track));
18326
+ this.publishStream.addTrack(capturedAudioTracks[0]);
18327
+ }
18328
+ }
18329
+ // setting local stream will trigger a publish/subscribe when edge-node-id is ready
18330
+ this.mediaHandler.localStream$.next(this.publishStream);
18331
+ }
18332
+ }))
18333
+ .catch((error) => {
18334
+ self.options.userMessages.next(new __1.DeviceErrorMessage(error));
18335
+ console.error('device error: ', error);
18336
+ this.sendMediaUnavailableInfo(error.name === 'NotAllowedError');
18337
+ this.revertMediaOptions();
18338
+ });
18339
+ }
18340
+ setMicDevice(deviceId, getDevices = true) {
18341
+ const device = this.devices.audioInput.filter((_device) => _device.deviceId === deviceId);
18342
+ if (device && device.length > 0) {
18343
+ this.options.uneeqOptions.preferredMicrophoneId = deviceId;
18344
+ this.audioConstraints.deviceId = deviceId;
18345
+ if (getDevices) {
18346
+ this.mediaHandler.publishingStream = false;
18347
+ this.getDevices(true);
18348
+ }
18349
+ this.options.userMessages.next(new __1.SetMicSuccessMessage(deviceId));
18350
+ }
18351
+ else {
18352
+ const msg = 'Uneeq setMic: Error setting device. Device not found.';
18353
+ this.options.userMessages.next(new __1.DeviceNotFoundErrorMessage(msg, deviceId));
18354
+ }
18355
+ }
18356
+ setCamDevice(deviceId, getDevices = true) {
18357
+ const device = this.devices.videoInput.filter((_device) => _device.deviceId === deviceId);
18358
+ if (device && device.length > 0) {
18359
+ this.options.uneeqOptions.preferredCameraId = deviceId;
18360
+ this.videoConstraints.deviceId = deviceId;
18361
+ if (getDevices) {
18362
+ this.mediaHandler.publishingStream = false;
18363
+ this.getDevices(true);
18364
+ }
18365
+ this.options.userMessages.next(new __1.SetCameraSuccessMessage(deviceId));
18366
+ }
18367
+ else {
18368
+ const msg = 'Uneeq setCamera: Error setting device. Device not found.';
18369
+ this.options.userMessages.next(new __1.DeviceNotFoundErrorMessage(msg, deviceId));
18370
+ }
18371
+ }
18372
+ setAvatarSpeakerDevice(deviceId) {
18373
+ if (this.mediaHandler.avatarVideoElement) {
18374
+ const device = this.devices.audioOutput.filter((_device) => _device.deviceId === deviceId);
18375
+ if (device && device.length > 0) {
18376
+ this.options.uneeqOptions.preferredSpeakerId = deviceId;
18377
+ this.mediaHandler.avatarVideoElement.setSinkId(deviceId).then(() => {
18378
+ this.speakerConstraints.deviceId = deviceId;
18379
+ this.options.userMessages.next(new __1.SetSpeakerSuccessMessage(deviceId));
18380
+ }).catch((error) => {
18381
+ const msg = 'Uneeq setSpeaker: Error setting device. ' + error.message;
18382
+ this.options.userMessages.next(new __1.DeviceNotFoundErrorMessage(msg, deviceId));
18297
18383
  });
18298
- });
18384
+ }
18385
+ else {
18386
+ const msg = 'Uneeq setSpeaker: Error setting device. Device not found.';
18387
+ this.options.userMessages.next(new __1.DeviceNotFoundErrorMessage(msg, deviceId));
18388
+ }
18299
18389
  }
18300
18390
  }
18301
- playRemoteVideoWithExponentialBackoff() {
18302
- // Play the digital human video when session is live (i.e. video and audio streaming in both directions)
18303
- if (this.video) {
18304
- this.video.autoplay = true;
18305
- this.video.play();
18306
- // Re-call play() on the DH video after some time out (exponential backoff) up to 10 times.
18307
- // This is to work around a bug in Safari 15 that prevents the video stream from being visible some times.
18308
- this.remoteVideoPlayCount++;
18309
- setTimeout(() => {
18310
- if (this.remoteVideoPlayCount < 10) {
18311
- this.playRemoteVideoWithExponentialBackoff();
18312
- }
18313
- }, 100 * (this.remoteVideoPlayCount - 1));
18391
+ revertMediaOptions() {
18392
+ if (this.previousMediaOptions) {
18393
+ this.options.uneeqOptions.sendLocalAudio = this.previousMediaOptions.sendLocalAudio;
18394
+ this.options.uneeqOptions.sendLocalVideo = this.previousMediaOptions.sendLocalVideo;
18314
18395
  }
18315
18396
  }
18397
+ initMediaConstraints() {
18398
+ this.audioConstraints = {};
18399
+ this.videoConstraints = { facingMode: 'user', width: 640, height: 480 };
18400
+ this.userMediaConstraints = {
18401
+ audio: this.options.uneeqOptions.sendLocalAudio ? this.audioConstraints : false,
18402
+ video: this.options.uneeqOptions.sendLocalVideo ? this.videoConstraints : false,
18403
+ };
18404
+ }
18405
+ initStreamWithoutDevices() {
18406
+ this.publishStream.getTracks().forEach((track) => this.publishStream.removeTrack(track));
18407
+ this.publishStream = new MediaStream();
18408
+ this.options.internalMessages$.next({ faceMeMessageType: 'DevicePermissionAllowedInternal' });
18409
+ this.options.streamManager.addCanvasVideoTrackToStream(this.publishStream);
18410
+ this.options.streamManager.addSilentAudioTrackToStream(this.publishStream);
18411
+ // setting local stream will trigger a publish/subscribe when edge-node-id is ready
18412
+ this.mediaHandler.localStream$.next(this.publishStream);
18413
+ }
18414
+ remoteVideoReady() {
18415
+ if (this.options.uneeqOptions.preferredSpeakerId) {
18416
+ this.setAvatarSpeakerDevice(this.options.uneeqOptions.preferredSpeakerId);
18417
+ }
18418
+ }
18419
+ sendMediaUnavailableInfo(hasUserDeniedPermission) {
18420
+ return __awaiter(this, void 0, void 0, function* () {
18421
+ const deviceList = yield this.getMediaDevices();
18422
+ const mediaUnavailableRequest = {
18423
+ audioInputs: deviceList.audioInput.length,
18424
+ videoInputs: deviceList.videoInput.length,
18425
+ hasUserDeniedPermission: hasUserDeniedPermission
18426
+ };
18427
+ return this.api.sendMediaUnavailable(mediaUnavailableRequest);
18428
+ });
18429
+ }
18430
+ getMediaDevices() {
18431
+ return __awaiter(this, void 0, void 0, function* () {
18432
+ const devices = yield navigator.mediaDevices.enumerateDevices();
18433
+ const deviceList = { audioInput: [], audioOutput: [], videoInput: [] };
18434
+ deviceList.audioInput = devices.filter((device) => device.kind === 'audioinput');
18435
+ deviceList.audioOutput = devices.filter((device) => device.kind === 'audiooutput');
18436
+ deviceList.videoInput = devices.filter((device) => device.kind === 'videoinput');
18437
+ return deviceList;
18438
+ });
18439
+ }
18440
+ initDeviceList() {
18441
+ return __awaiter(this, void 0, void 0, function* () {
18442
+ navigator.mediaDevices.ondevicechange = (e) => { this.initDeviceList(); };
18443
+ const deviceList = yield this.getMediaDevices();
18444
+ /* We get mediaDevices.ondevicechange multiple times, but some are the same. Check if the device list has changed */
18445
+ if (!(JSON.stringify(deviceList) === JSON.stringify(this.devices))) {
18446
+ this.devices = deviceList;
18447
+ // Set default mic and cam
18448
+ if (this.options.uneeqOptions.preferredCameraId) {
18449
+ this.setCamDevice(this.options.uneeqOptions.preferredCameraId, false);
18450
+ }
18451
+ if (this.options.uneeqOptions.preferredMicrophoneId) {
18452
+ this.setMicDevice(this.options.uneeqOptions.preferredMicrophoneId, false);
18453
+ }
18454
+ this.options.userMessages.next(new __1.DeviceListUpdatedMessage(this.devices));
18455
+ }
18456
+ });
18457
+ }
18316
18458
  }
18317
- exports.DigitalHumanVideoPlayManager = DigitalHumanVideoPlayManager;
18459
+ exports.DeviceManager = DeviceManager;
18318
18460
 
18319
18461
 
18320
18462
  /***/ }),
@@ -18324,902 +18466,144 @@ exports.DigitalHumanVideoPlayManager = DigitalHumanVideoPlayManager;
18324
18466
  "use strict";
18325
18467
 
18326
18468
  Object.defineProperty(exports, "__esModule", { value: true });
18327
- exports.DigitalHumanUnmuted = exports.DigitalHumanPlayedInMutedModeSuccess = exports.DigitalHumanFailedToPlay = exports.DigitalHumanVideoError = exports.ClientPerformanceMessage = exports.ClientMediaStreamUpdateMessage = exports.OnlineStatusUpdateMessage = exports.SessionInfoMessage = exports.AvatarRequestIgnored = exports.AvatarRequestCompleted = exports.SessionErrorMessage = exports.WebRtcStatsMessage = exports.WebRtcDataMessage = exports.SessionLiveMessage = exports.WarningMessage = exports.RecordingStoppedMessage = exports.RecordingStartedMessage = exports.DevicePermissionAllowedMessage = exports.AvatarTextInputFinishedMessage = exports.FinishedSpeakingMessage = exports.StartedSpeakingMessage = exports.AvatarQuestionMessage = exports.InstructionsMessage = exports.AvatarAnswerContentMessage = exports.AvatarAnswerMessage = exports.ConnectionLostMessage = exports.VoiceActivityInputModeNotSupportedMessage = exports.MicActivityNotSupportedMessage = exports.MicActivityMessage = exports.MicActivityErrorMessage = exports.ServiceUnavailableMessage = exports.AvatarUnavailableMessage = exports.AvatarAvailableMessage = exports.SessionEndedMessage = exports.SessionResumedMessage = exports.SessionPausedMessage = exports.DeviceListUpdatedMessage = exports.DeviceErrorMessage = exports.SetSpeakerSuccessMessage = exports.SetMicSuccessMessage = exports.SetCameraSuccessMessage = exports.DeviceNotFoundErrorMessage = exports.ReadyMessage = exports.UneeqMessageType = void 0;
18328
- var UneeqMessageType;
18329
- (function (UneeqMessageType) {
18330
- UneeqMessageType["Ready"] = "Ready";
18331
- UneeqMessageType["DeviceNotFoundError"] = "DeviceNotFoundError";
18332
- UneeqMessageType["SetCameraSuccess"] = "SetCameraSuccess";
18333
- UneeqMessageType["SetMicSuccess"] = "SetMicSuccess";
18334
- UneeqMessageType["SetSpeakerSuccess"] = "SetSpeakerSuccess";
18335
- UneeqMessageType["SessionPaused"] = "SessionPaused";
18336
- UneeqMessageType["SessionResumed"] = "SessionResumed";
18337
- UneeqMessageType["SessionEnded"] = "SessionEnded";
18338
- UneeqMessageType["AvatarAvailable"] = "AvatarAvailable";
18339
- UneeqMessageType["AvatarUnavailable"] = "AvatarUnavailable";
18340
- UneeqMessageType["ConnectionLost"] = "ConnectionLost";
18341
- UneeqMessageType["ServiceUnavailable"] = "ServiceUnavailable";
18342
- UneeqMessageType["OnlineStatusUpdate"] = "OnlineStatusUpdate";
18343
- UneeqMessageType["MicActivityNotSupported"] = "MicActivityNotSupported";
18344
- UneeqMessageType["VoiceActivityInputModeNotSupported"] = "VoiceActivityInputModeNotSupported";
18345
- UneeqMessageType["MicActivityError"] = "MicActivityError";
18346
- UneeqMessageType["MicActivity"] = "MicActivity";
18347
- UneeqMessageType["DeviceError"] = "DeviceError";
18348
- UneeqMessageType["DeviceListUpdated"] = "DeviceListUpdated";
18349
- UneeqMessageType["AvatarAnswer"] = "AvatarAnswer";
18350
- UneeqMessageType["AvatarAnswerContent"] = "AvatarAnswerContent";
18351
- UneeqMessageType["Instructions"] = "Instructions";
18352
- UneeqMessageType["StartedSpeaking"] = "StartedSpeaking";
18353
- UneeqMessageType["FinishedSpeaking"] = "FinishedSpeaking";
18354
- UneeqMessageType["AvatarTextInputFinished"] = "AvatarTextInputFinished";
18355
- UneeqMessageType["AvatarQuestionText"] = "AvatarQuestionText";
18356
- UneeqMessageType["DevicePermissionAllowed"] = "DevicePermissionAllowed";
18357
- UneeqMessageType["RecordingStarted"] = "RecordingStarted";
18358
- UneeqMessageType["RecordingStopped"] = "RecordingStopped";
18359
- UneeqMessageType["Warning"] = "Warning";
18360
- UneeqMessageType["SessionLive"] = "SessionLive";
18361
- UneeqMessageType["WebRtcData"] = "WebRtcData";
18362
- UneeqMessageType["WebRtcStats"] = "WebRtcStats";
18363
- UneeqMessageType["SessionError"] = "SessionError";
18364
- UneeqMessageType["SessionInfo"] = "SessionInfo";
18365
- UneeqMessageType["AvatarRequestCompleted"] = "AvatarRequestCompleted";
18366
- UneeqMessageType["AvatarRequestIgnored"] = "AvatarRequestIgnored";
18367
- UneeqMessageType["ClientMediaStreamUpdate"] = "ClientMediaStreamUpdate";
18368
- UneeqMessageType["ClientPerformanceMessage"] = "ClientPerformanceMessage";
18369
- UneeqMessageType["DigitalHumanVideoError"] = "DigitalHumanVideoError";
18370
- UneeqMessageType["DigitalHumanFailedToPlay"] = "DigitalHumanFailedToPlay";
18371
- UneeqMessageType["DigitalHumanPlayedInMutedModeSuccess"] = "DigitalHumanPlayedInMutedModeSuccess";
18372
- UneeqMessageType["DigitalHumanUnmuted"] = "DigitalHumanUnmuted";
18373
- })(UneeqMessageType = exports.UneeqMessageType || (exports.UneeqMessageType = {}));
18374
- /**
18375
- * Service is ready to be used
18376
- */
18377
- class ReadyMessage {
18378
- constructor() {
18379
- this.uneeqMessageType = UneeqMessageType.Ready;
18469
+ exports.MediaHandler = void 0;
18470
+ const rxjs_1 = __webpack_require__(20);
18471
+ const __1 = __webpack_require__(0);
18472
+ const videoeditor_1 = __webpack_require__(228);
18473
+ const PublishSubscribeState_1 = __webpack_require__(231);
18474
+ const canvas_service_1 = __webpack_require__(232);
18475
+ const logger_1 = __webpack_require__(233);
18476
+ const uneeq_webrtc_1 = __webpack_require__(234);
18477
+ class MediaHandler {
18478
+ /* MediaHandler should not be used until messaging is ready */
18479
+ constructor(options, remoteVideoReady) {
18480
+ this.options = options;
18481
+ this.remoteVideoReady = remoteVideoReady;
18482
+ /* Subscribe */
18483
+ this.remoteStream$ = new rxjs_1.BehaviorSubject(null);
18484
+ /* Publish */
18485
+ this.localStream$ = new rxjs_1.BehaviorSubject(null);
18486
+ this.publishState$ = new rxjs_1.BehaviorSubject(PublishSubscribeState_1.PublishSubscribeState.DISCONNECTED);
18487
+ this.publishingStream = false;
18488
+ this.remoteStream$.filter((stream) => stream !== null).subscribe((stream) => {
18489
+ const video = document.createElement('video');
18490
+ this.avatarVideoElement = video;
18491
+ video.srcObject = stream;
18492
+ video.volume = 1;
18493
+ video.controls = false;
18494
+ video.autoplay = false;
18495
+ video.setAttribute('playsinline', 'true'); // required for iOS
18496
+ video.setAttribute('style', 'object-fit: cover; width: 100%; height: 100%;');
18497
+ options.uneeqOptions.avatarVideoContainerElement.style.overflow = 'hidden';
18498
+ options.uneeqOptions.avatarVideoContainerElement.innerHTML = '';
18499
+ options.uneeqOptions.avatarVideoContainerElement.appendChild(video);
18500
+ if (this.options.uneeqOptions.enableTransparentBackground) {
18501
+ this.initTransparentBackground(video);
18502
+ }
18503
+ remoteVideoReady();
18504
+ });
18505
+ this.localStream$.filter((stream) => stream !== null).subscribe((stream) => {
18506
+ const video = document.createElement('video');
18507
+ this.localVideoElement = video;
18508
+ video.srcObject = stream;
18509
+ video.autoplay = true;
18510
+ video.muted = true;
18511
+ video.setAttribute('playsinline', 'true'); // required for iOS
18512
+ video.setAttribute('style', 'width: 100%; height: 100%;');
18513
+ options.uneeqOptions.localVideoContainerElement.innerHTML = '';
18514
+ options.uneeqOptions.localVideoContainerElement.appendChild(video);
18515
+ // provide the users local stream to the voice input manager
18516
+ this.options.voiceInputManager.initMicActivity(stream);
18517
+ if (this.options.session.edgeNodeId && !this.publishingStream) {
18518
+ this.publishVideo();
18519
+ }
18520
+ });
18521
+ // handle the WebRTC messages
18522
+ this.options.internalMessages$.filter((message) => message.faceMeMessageType === 'AnswerMessage')
18523
+ .subscribe((msg) => {
18524
+ if (this.webRTC !== undefined) {
18525
+ this.webRTC.handleAnswerMessage(msg);
18526
+ }
18527
+ });
18528
+ this.options.internalMessages$.filter((message) => message.faceMeMessageType === 'IceCandidateMessage')
18529
+ .subscribe((msg) => {
18530
+ if (this.webRTC !== undefined) {
18531
+ this.webRTC.handleIceCandidate(msg);
18532
+ }
18533
+ });
18380
18534
  }
18381
- }
18382
- exports.ReadyMessage = ReadyMessage;
18383
- /**
18384
- * Selected device is not found
18385
- */
18386
- class DeviceNotFoundErrorMessage {
18387
- constructor(msg, deviceId) {
18388
- this.msg = msg;
18389
- this.deviceId = deviceId;
18390
- this.uneeqMessageType = UneeqMessageType.DeviceNotFoundError;
18535
+ setEdgeNodeId(edgeNodeId) {
18536
+ this.options.session.edgeNodeId = edgeNodeId;
18537
+ if (this.options.session.edgeNodeId && !this.publishingStream && this.localStream$.getValue()) {
18538
+ this.publishVideo();
18539
+ }
18391
18540
  }
18392
- }
18393
- exports.DeviceNotFoundErrorMessage = DeviceNotFoundErrorMessage;
18394
- /**
18395
- * Users camera has been set successfully
18396
- */
18397
- class SetCameraSuccessMessage {
18398
- constructor(deviceId) {
18399
- this.deviceId = deviceId;
18400
- this.uneeqMessageType = UneeqMessageType.SetCameraSuccess;
18541
+ unpublishVideo() {
18542
+ logger_1.logger.log('UserSession | unpublishVideo');
18543
+ if (this.webRTC !== undefined) {
18544
+ this.webRTC.close();
18545
+ this.webRTC = undefined;
18546
+ }
18547
+ this.publishState$.next(PublishSubscribeState_1.PublishSubscribeState.DISCONNECTED);
18401
18548
  }
18402
- }
18403
- exports.SetCameraSuccessMessage = SetCameraSuccessMessage;
18404
- /**
18405
- * Users microphone has been set successfully
18406
- */
18407
- class SetMicSuccessMessage {
18408
- constructor(deviceId) {
18409
- this.deviceId = deviceId;
18410
- this.uneeqMessageType = UneeqMessageType.SetMicSuccess;
18549
+ /* Stops local video/audio from sending. Pauses both local and remote video elements */
18550
+ pause() {
18551
+ const remoteStream = this.remoteStream$.getValue();
18552
+ const localStream = this.localStream$.getValue();
18553
+ this.avatarVideoElement.pause();
18554
+ this.localVideoElement.pause();
18555
+ if (localStream) {
18556
+ localStream.getTracks().forEach((track) => track.enabled = false);
18557
+ }
18558
+ if (remoteStream) {
18559
+ remoteStream.getTracks().forEach((track) => track.enabled = false);
18560
+ }
18411
18561
  }
18412
- }
18413
- exports.SetMicSuccessMessage = SetMicSuccessMessage;
18414
- /**
18415
- * Users speaker has been set successfully
18416
- */
18417
- class SetSpeakerSuccessMessage {
18418
- constructor(deviceId) {
18419
- this.deviceId = deviceId;
18420
- this.uneeqMessageType = UneeqMessageType.SetSpeakerSuccess;
18562
+ /* Starts local video/audio sending if paused. Plays both local and remote video elements */
18563
+ resume() {
18564
+ const remoteStream = this.remoteStream$.getValue();
18565
+ const localStream = this.localStream$.getValue();
18566
+ if (localStream) {
18567
+ localStream.getTracks().forEach((track) => track.enabled = true);
18568
+ }
18569
+ if (remoteStream) {
18570
+ remoteStream.getTracks().forEach((track) => track.enabled = true);
18571
+ }
18572
+ this.avatarVideoElement.play();
18573
+ this.localVideoElement.play();
18421
18574
  }
18422
- }
18423
- exports.SetSpeakerSuccessMessage = SetSpeakerSuccessMessage;
18424
- /**
18425
- * An error has occured with the users device
18426
- */
18427
- class DeviceErrorMessage {
18428
- constructor(error) {
18429
- this.error = error;
18430
- this.uneeqMessageType = UneeqMessageType.DeviceError;
18575
+ stopAllLocalStreams() {
18576
+ const localStream = this.localStream$.getValue();
18577
+ if (localStream) {
18578
+ localStream.getTracks().forEach((track) => track.stop());
18579
+ }
18580
+ this.publishingStream = false;
18431
18581
  }
18432
- }
18433
- exports.DeviceErrorMessage = DeviceErrorMessage;
18434
- /**
18435
- * The device list has been changed or retrieved for the first time
18436
- */
18437
- class DeviceListUpdatedMessage {
18438
- constructor(devices) {
18439
- this.devices = devices;
18440
- this.uneeqMessageType = UneeqMessageType.DeviceListUpdated;
18582
+ endSession() {
18583
+ // Stop Publish
18584
+ this.stopAllLocalStreams();
18585
+ if (this.options.uneeqOptions.localVideoContainerElement && this.options.uneeqOptions.localVideoContainerElement) {
18586
+ this.options.uneeqOptions.localVideoContainerElement.innerHTML = '';
18587
+ }
18588
+ this.unpublishVideo();
18589
+ // Stop Subscribe
18590
+ if (this.options.uneeqOptions.avatarVideoContainerElement && this.options.uneeqOptions.avatarVideoContainerElement) {
18591
+ this.options.uneeqOptions.avatarVideoContainerElement.innerHTML = '';
18592
+ }
18593
+ const remoteStream = this.remoteStream$.getValue();
18594
+ if (remoteStream) {
18595
+ remoteStream.getTracks().forEach((track) => track.stop());
18596
+ }
18597
+ this.options.voiceInputManager.handleSessionEnd();
18441
18598
  }
18442
- }
18443
- exports.DeviceListUpdatedMessage = DeviceListUpdatedMessage;
18444
- /**
18445
- * Session has been paused successfully
18446
- */
18447
- class SessionPausedMessage {
18448
- constructor() {
18449
- this.uneeqMessageType = UneeqMessageType.SessionPaused;
18599
+ sendDataMessage(msg) {
18600
+ if (this.webRTC) {
18601
+ this.webRTC.sendDataMessage(msg);
18602
+ }
18450
18603
  }
18451
- }
18452
- exports.SessionPausedMessage = SessionPausedMessage;
18453
- /**
18454
- * Session has been resumed successfully
18455
- */
18456
- class SessionResumedMessage {
18457
- constructor() {
18458
- this.uneeqMessageType = UneeqMessageType.SessionResumed;
18459
- }
18460
- }
18461
- exports.SessionResumedMessage = SessionResumedMessage;
18462
- /**
18463
- * Session has been ended successfully
18464
- */
18465
- class SessionEndedMessage {
18466
- constructor() {
18467
- this.uneeqMessageType = UneeqMessageType.SessionEnded;
18468
- }
18469
- }
18470
- exports.SessionEndedMessage = SessionEndedMessage;
18471
- /**
18472
- * An avatar is available
18473
- */
18474
- class AvatarAvailableMessage {
18475
- constructor() {
18476
- this.uneeqMessageType = UneeqMessageType.AvatarAvailable;
18477
- }
18478
- }
18479
- exports.AvatarAvailableMessage = AvatarAvailableMessage;
18480
- /**
18481
- * There are no avatars currently available
18482
- */
18483
- class AvatarUnavailableMessage {
18484
- constructor() {
18485
- this.uneeqMessageType = UneeqMessageType.AvatarUnavailable;
18486
- }
18487
- }
18488
- exports.AvatarUnavailableMessage = AvatarUnavailableMessage;
18489
- /**
18490
- * Service is unavailable
18491
- */
18492
- class ServiceUnavailableMessage {
18493
- constructor(error) {
18494
- this.error = error;
18495
- this.uneeqMessageType = UneeqMessageType.ServiceUnavailable;
18496
- }
18497
- }
18498
- exports.ServiceUnavailableMessage = ServiceUnavailableMessage;
18499
- /**
18500
- * An error occured with mic activity messages
18501
- */
18502
- class MicActivityErrorMessage {
18503
- constructor(error) {
18504
- this.error = error;
18505
- this.uneeqMessageType = UneeqMessageType.MicActivityError;
18506
- }
18507
- }
18508
- exports.MicActivityErrorMessage = MicActivityErrorMessage;
18509
- /**
18510
- * Message is sent upon activity of the user microphone
18511
- *
18512
- * Visibility is controlled by UneeqOptions param micActivityMessages
18513
- */
18514
- class MicActivityMessage {
18515
- constructor(level) {
18516
- this.level = level;
18517
- this.uneeqMessageType = UneeqMessageType.MicActivity;
18518
- }
18519
- }
18520
- exports.MicActivityMessage = MicActivityMessage;
18521
- /**
18522
- * Mic activity messages are not supported by the users browser
18523
- *
18524
- * Visibility is controlled by UneeqOptions param micActivityMessages
18525
- */
18526
- class MicActivityNotSupportedMessage {
18527
- constructor() {
18528
- this.uneeqMessageType = UneeqMessageType.MicActivityNotSupported;
18529
- }
18530
- }
18531
- exports.MicActivityNotSupportedMessage = MicActivityNotSupportedMessage;
18532
- /**
18533
- * Mic activity input mode is not supported by the users browser
18534
- */
18535
- class VoiceActivityInputModeNotSupportedMessage {
18536
- constructor() {
18537
- this.uneeqMessageType = UneeqMessageType.VoiceActivityInputModeNotSupported;
18538
- }
18539
- }
18540
- exports.VoiceActivityInputModeNotSupportedMessage = VoiceActivityInputModeNotSupportedMessage;
18541
- /**
18542
- * Connection Lost
18543
- */
18544
- class ConnectionLostMessage {
18545
- constructor(connectionState) {
18546
- this.connectionState = connectionState;
18547
- this.uneeqMessageType = UneeqMessageType.ConnectionLost;
18548
- }
18549
- }
18550
- exports.ConnectionLostMessage = ConnectionLostMessage;
18551
- /**
18552
- * The avatar's answer to a question
18553
- */
18554
- class AvatarAnswerMessage {
18555
- constructor(answer, answerAvatar, answerSpeech, transcriptId) {
18556
- this.answer = answer;
18557
- this.answerAvatar = answerAvatar;
18558
- this.answerSpeech = answerSpeech;
18559
- this.transcriptId = transcriptId;
18560
- this.uneeqMessageType = UneeqMessageType.AvatarAnswer;
18561
- }
18562
- }
18563
- exports.AvatarAnswerMessage = AvatarAnswerMessage;
18564
- /**
18565
- * The avatar's answer to a question (HTML Content)
18566
- */
18567
- class AvatarAnswerContentMessage {
18568
- /**
18569
- * @param content Note: If `hasDisplayHtml` = true, this content will contain the HTML provided by the displayHTML instruction.
18570
- * If `hasDisplayHtml` = false, this content will contain the `answer` value
18571
- * @param transcriptId
18572
- * @param hasDisplayHtml
18573
- */
18574
- constructor(content, transcriptId, hasDisplayHtml = false) {
18575
- this.content = content;
18576
- this.transcriptId = transcriptId;
18577
- this.hasDisplayHtml = hasDisplayHtml;
18578
- this.uneeqMessageType = UneeqMessageType.AvatarAnswerContent;
18579
- }
18580
- }
18581
- exports.AvatarAnswerContentMessage = AvatarAnswerContentMessage;
18582
- class InstructionsMessage {
18583
- /**
18584
- *
18585
- * @param instructions is an object defined on the NLP which is passed to the client in response to certain questions
18586
- */
18587
- constructor(instructions) {
18588
- this.instructions = instructions;
18589
- this.uneeqMessageType = UneeqMessageType.Instructions;
18590
- }
18591
- }
18592
- exports.InstructionsMessage = InstructionsMessage;
18593
- /**
18594
- * The question the user asked
18595
- */
18596
- class AvatarQuestionMessage {
18597
- constructor(question, transcriptId) {
18598
- this.question = question;
18599
- this.transcriptId = transcriptId;
18600
- this.uneeqMessageType = UneeqMessageType.AvatarQuestionText;
18601
- }
18602
- }
18603
- exports.AvatarQuestionMessage = AvatarQuestionMessage;
18604
- /**
18605
- * Digital human has started speaking the message
18606
- */
18607
- class StartedSpeakingMessage {
18608
- constructor() {
18609
- this.uneeqMessageType = UneeqMessageType.StartedSpeaking;
18610
- }
18611
- }
18612
- exports.StartedSpeakingMessage = StartedSpeakingMessage;
18613
- /**
18614
- * Digital human has finished speaking the message
18615
- */
18616
- class FinishedSpeakingMessage {
18617
- constructor() {
18618
- this.uneeqMessageType = UneeqMessageType.FinishedSpeaking;
18619
- }
18620
- }
18621
- exports.FinishedSpeakingMessage = FinishedSpeakingMessage;
18622
- /**
18623
- * [Deprecated] Avatar has finished speaking the message. Deprecated, use FinishedSpeakingMessage
18624
- */
18625
- class AvatarTextInputFinishedMessage {
18626
- constructor() {
18627
- this.uneeqMessageType = UneeqMessageType.AvatarTextInputFinished;
18628
- }
18629
- }
18630
- exports.AvatarTextInputFinishedMessage = AvatarTextInputFinishedMessage;
18631
- /**
18632
- * User has given permission to use devices
18633
- */
18634
- class DevicePermissionAllowedMessage {
18635
- constructor() {
18636
- this.uneeqMessageType = UneeqMessageType.DevicePermissionAllowed;
18637
- }
18638
- }
18639
- exports.DevicePermissionAllowedMessage = DevicePermissionAllowedMessage;
18640
- /**
18641
- * User has started a recording successfully
18642
- */
18643
- class RecordingStartedMessage {
18644
- constructor() {
18645
- this.uneeqMessageType = UneeqMessageType.RecordingStarted;
18646
- }
18647
- }
18648
- exports.RecordingStartedMessage = RecordingStartedMessage;
18649
- /**
18650
- * User has stopped recording successfully
18651
- */
18652
- class RecordingStoppedMessage {
18653
- constructor() {
18654
- this.uneeqMessageType = UneeqMessageType.RecordingStopped;
18655
- }
18656
- }
18657
- exports.RecordingStoppedMessage = RecordingStoppedMessage;
18658
- /**
18659
- * General Warning Message - refer to msg
18660
- */
18661
- class WarningMessage {
18662
- constructor(msg) {
18663
- this.msg = msg;
18664
- this.uneeqMessageType = UneeqMessageType.Warning;
18665
- }
18666
- }
18667
- exports.WarningMessage = WarningMessage;
18668
- /**
18669
- * Session is Live, avatar video is active
18670
- */
18671
- class SessionLiveMessage {
18672
- constructor(showLogo) {
18673
- this.showLogo = showLogo;
18674
- this.uneeqMessageType = UneeqMessageType.SessionLive;
18675
- }
18676
- }
18677
- exports.SessionLiveMessage = SessionLiveMessage;
18678
- /**
18679
- * WebRTC data channel message
18680
- */
18681
- class WebRtcDataMessage {
18682
- constructor(data) {
18683
- this.data = data;
18684
- this.uneeqMessageType = UneeqMessageType.WebRtcData;
18685
- }
18686
- }
18687
- exports.WebRtcDataMessage = WebRtcDataMessage;
18688
- /**
18689
- * WebRTC stats message (diagnostics)
18690
- */
18691
- class WebRtcStatsMessage {
18692
- constructor(stats) {
18693
- this.stats = stats;
18694
- this.uneeqMessageType = UneeqMessageType.WebRtcStats;
18695
- }
18696
- }
18697
- exports.WebRtcStatsMessage = WebRtcStatsMessage;
18698
- /**
18699
- * Session Error has occurred
18700
- */
18701
- class SessionErrorMessage {
18702
- constructor(error) {
18703
- this.error = error;
18704
- this.uneeqMessageType = UneeqMessageType.SessionError;
18705
- }
18706
- }
18707
- exports.SessionErrorMessage = SessionErrorMessage;
18708
- /**
18709
- * Avatar request completed: the Avatar has completed processing a text or instruction request
18710
- */
18711
- class AvatarRequestCompleted {
18712
- constructor(reason) {
18713
- this.reason = reason;
18714
- this.uneeqMessageType = UneeqMessageType.AvatarRequestCompleted;
18715
- }
18716
- }
18717
- exports.AvatarRequestCompleted = AvatarRequestCompleted;
18718
- /**
18719
- * Avatar request ignored: the Avatar has ignored a request to speak
18720
- */
18721
- class AvatarRequestIgnored {
18722
- constructor(reason) {
18723
- this.reason = reason;
18724
- this.uneeqMessageType = UneeqMessageType.AvatarRequestIgnored;
18725
- }
18726
- }
18727
- exports.AvatarRequestIgnored = AvatarRequestIgnored;
18728
- /**
18729
- * Session Info Messages: Primarily used for testing, e.g. the active behaviour tag
18730
- */
18731
- class SessionInfoMessage {
18732
- constructor(info) {
18733
- this.info = info;
18734
- this.uneeqMessageType = UneeqMessageType.SessionInfo;
18735
- }
18736
- }
18737
- exports.SessionInfoMessage = SessionInfoMessage;
18738
- /**
18739
- * Clients network status has changed. {online: true|false}
18740
- */
18741
- class OnlineStatusUpdateMessage {
18742
- constructor(online) {
18743
- this.online = online;
18744
- this.uneeqMessageType = UneeqMessageType.OnlineStatusUpdate;
18745
- }
18746
- }
18747
- exports.OnlineStatusUpdateMessage = OnlineStatusUpdateMessage;
18748
- class ClientMediaStreamUpdateMessage {
18749
- constructor(clientStreamingAudio, clientStreamingVideo, serverStreamingAudio, serverStreamingVideo) {
18750
- this.clientStreamingAudio = clientStreamingAudio;
18751
- this.clientStreamingVideo = clientStreamingVideo;
18752
- this.serverStreamingAudio = serverStreamingAudio;
18753
- this.serverStreamingVideo = serverStreamingVideo;
18754
- this.uneeqMessageType = UneeqMessageType.ClientMediaStreamUpdate;
18755
- }
18756
- }
18757
- exports.ClientMediaStreamUpdateMessage = ClientMediaStreamUpdateMessage;
18758
- /**
18759
- * These WebRTC statistics help identify if session quality is being impacted by client-side conditions.
18760
- * Messages are sent every 5 seconds, and are visible in the console if enableClientPerformanceMessage = true.
18761
- */
18762
- class ClientPerformanceMessage {
18763
- constructor(clientPerformance) {
18764
- this.clientPerformance = clientPerformance;
18765
- this.uneeqMessageType = UneeqMessageType.ClientPerformanceMessage;
18766
- }
18767
- }
18768
- exports.ClientPerformanceMessage = ClientPerformanceMessage;
18769
- /**
18770
- * DigitalHuman Video Error has occurred
18771
- */
18772
- class DigitalHumanVideoError {
18773
- constructor(error) {
18774
- this.error = error;
18775
- this.uneeqMessageType = UneeqMessageType.DigitalHumanVideoError;
18776
- }
18777
- }
18778
- exports.DigitalHumanVideoError = DigitalHumanVideoError;
18779
- /**
18780
- * DigitalHuman Failed to play
18781
- */
18782
- class DigitalHumanFailedToPlay {
18783
- constructor() {
18784
- this.uneeqMessageType = UneeqMessageType.DigitalHumanFailedToPlay;
18785
- this.msg = "Digital Human failed to play with sound. This most likely occurred because the user has " +
18786
- "not yet interacted with the page and was blocked due to the browser's autoplay policy. Video will automatically " +
18787
- "be muted and attempted to be played again.";
18788
- }
18789
- }
18790
- exports.DigitalHumanFailedToPlay = DigitalHumanFailedToPlay;
18791
- /**
18792
- * DigitalHuman was successfully played in muted mode
18793
- */
18794
- class DigitalHumanPlayedInMutedModeSuccess {
18795
- constructor() {
18796
- this.uneeqMessageType = UneeqMessageType.DigitalHumanPlayedInMutedModeSuccess;
18797
- this.msg = "Digital Human was successfully played in muted mode. After the user interacts with the page you will need " +
18798
- "to call unmuteDigitalHuman() to unmute the video.";
18799
- }
18800
- }
18801
- exports.DigitalHumanPlayedInMutedModeSuccess = DigitalHumanPlayedInMutedModeSuccess;
18802
- /**
18803
- * DigitalHuman was unmuted
18804
- */
18805
- class DigitalHumanUnmuted {
18806
- constructor() {
18807
- this.uneeqMessageType = UneeqMessageType.DigitalHumanUnmuted;
18808
- }
18809
- }
18810
- exports.DigitalHumanUnmuted = DigitalHumanUnmuted;
18811
-
18812
-
18813
- /***/ }),
18814
- /* 228 */
18815
- /***/ (function(module, exports, __webpack_require__) {
18816
-
18817
- "use strict";
18818
-
18819
- Object.defineProperty(exports, "__esModule", { value: true });
18820
- exports.logger = exports.Logger = exports.LogType = void 0;
18821
- var LogType;
18822
- (function (LogType) {
18823
- LogType["debug"] = "debug";
18824
- LogType["log"] = "log";
18825
- LogType["warn"] = "warn";
18826
- LogType["error"] = "error";
18827
- })(LogType = exports.LogType || (exports.LogType = {}));
18828
- class Logger {
18829
- constructor() {
18830
- this.enabled = false;
18831
- }
18832
- log(msg, ...supportingDetails) {
18833
- this.emitLogMessage(LogType.log, msg, supportingDetails);
18834
- }
18835
- warn(msg, ...supportingDetails) {
18836
- this.emitLogMessage(LogType.warn, msg, supportingDetails);
18837
- }
18838
- error(msg, ...supportingDetails) {
18839
- this.emitLogMessage(LogType.error, msg, supportingDetails);
18840
- }
18841
- debug(msg, ...supportingDetails) {
18842
- this.emitLogMessage(LogType.debug, msg, supportingDetails);
18843
- }
18844
- emitLogMessage(msgType, msg, supportingDetails) {
18845
- if (this.enabled || msgType === LogType.error) {
18846
- if (supportingDetails.length > 0) {
18847
- console[msgType](msg, supportingDetails);
18848
- }
18849
- else {
18850
- console[msgType](msg);
18851
- }
18852
- }
18853
- }
18854
- }
18855
- exports.Logger = Logger;
18856
- exports.logger = new Logger();
18857
-
18858
-
18859
- /***/ }),
18860
- /* 229 */
18861
- /***/ (function(module, exports, __webpack_require__) {
18862
-
18863
- "use strict";
18864
-
18865
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
18866
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
18867
- return new (P || (P = Promise))(function (resolve, reject) {
18868
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
18869
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
18870
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
18871
- step((generator = generator.apply(thisArg, _arguments || [])).next());
18872
- });
18873
- };
18874
- Object.defineProperty(exports, "__esModule", { value: true });
18875
- exports.DeviceManager = void 0;
18876
- const __1 = __webpack_require__(0);
18877
- const media_handler_1 = __webpack_require__(230);
18878
- class DeviceManager {
18879
- constructor(options, api) {
18880
- this.options = options;
18881
- this.api = api;
18882
- this.speakerConstraints = {};
18883
- this.publishStream = new MediaStream();
18884
- this.devices = { audioInput: [], audioOutput: [], videoInput: [] };
18885
- this.previousMediaOptions = {};
18886
- this.mediaHandler = new media_handler_1.MediaHandler(this.options, () => this.remoteVideoReady());
18887
- this.initMediaConstraints();
18888
- this.getDevices(false); // once the device list is updated the publish will be performed.
18889
- }
18890
- set edgeNodeId(edgeNodeId) {
18891
- this.mediaHandler.setEdgeNodeId(edgeNodeId);
18892
- this.getDevices(true);
18893
- }
18894
- enableLocalDevices(sendLocalVideo, sendLocalAudio) {
18895
- const videoOptionChanged = this.options.uneeqOptions.sendLocalVideo !== sendLocalVideo;
18896
- const audioOptionChanged = this.options.uneeqOptions.sendLocalAudio !== sendLocalAudio;
18897
- if (videoOptionChanged || audioOptionChanged) {
18898
- this.previousMediaOptions = {
18899
- sendLocalVideo: this.options.uneeqOptions.sendLocalVideo,
18900
- sendLocalAudio: this.options.uneeqOptions.sendLocalAudio
18901
- };
18902
- this.options.uneeqOptions.sendLocalVideo = sendLocalVideo;
18903
- this.options.uneeqOptions.sendLocalAudio = sendLocalAudio;
18904
- if (videoOptionChanged && sendLocalVideo === false) {
18905
- this.publishStream.getVideoTracks().forEach((stream) => stream.stop());
18906
- }
18907
- if (audioOptionChanged && sendLocalAudio === false) {
18908
- this.publishStream.getAudioTracks().forEach((stream) => stream.stop());
18909
- }
18910
- this.mediaHandler.publishingStream = false;
18911
- this.initMediaConstraints();
18912
- this.getDevices(true);
18913
- }
18914
- }
18915
- // Once the device list is updated the publish will be performed.
18916
- getDevices(publish = true) {
18917
- if (!this.options.uneeqOptions.sendLocalVideo && !this.options.uneeqOptions.sendLocalAudio) {
18918
- this.initStreamWithoutDevices();
18919
- return;
18920
- }
18921
- const self = this;
18922
- this.publishStream = new MediaStream();
18923
- this.options.streamManager.addCanvasVideoTrackToStream(this.publishStream);
18924
- this.options.streamManager.addSilentAudioTrackToStream(this.publishStream);
18925
- /* Get User Devices */
18926
- navigator.mediaDevices.getUserMedia(this.userMediaConstraints)
18927
- .then((localStream) => __awaiter(this, void 0, void 0, function* () {
18928
- this.initDeviceList();
18929
- this.options.internalMessages$.next({ faceMeMessageType: 'DevicePermissionAllowedInternal' });
18930
- if (publish) {
18931
- if (this.options.uneeqOptions.sendLocalVideo) {
18932
- const capturedVideoTracks = localStream.getVideoTracks();
18933
- if (capturedVideoTracks.length > 0) {
18934
- this.publishStream.getVideoTracks().forEach((track) => this.publishStream.removeTrack(track));
18935
- this.publishStream.addTrack(capturedVideoTracks[0]);
18936
- }
18937
- }
18938
- if (this.options.uneeqOptions.sendLocalAudio) {
18939
- const capturedAudioTracks = localStream.getAudioTracks();
18940
- if (capturedAudioTracks.length > 0) {
18941
- this.publishStream.getAudioTracks().forEach((track) => this.publishStream.removeTrack(track));
18942
- this.publishStream.addTrack(capturedAudioTracks[0]);
18943
- }
18944
- }
18945
- // setting local stream will trigger a publish/subscribe when edge-node-id is ready
18946
- this.mediaHandler.localStream$.next(this.publishStream);
18947
- }
18948
- }))
18949
- .catch((error) => {
18950
- self.options.userMessages.next(new __1.DeviceErrorMessage(error));
18951
- console.error('device error: ', error);
18952
- this.sendMediaUnavailableInfo(error.name === 'NotAllowedError');
18953
- this.revertMediaOptions();
18954
- });
18955
- }
18956
- setMicDevice(deviceId, getDevices = true) {
18957
- const device = this.devices.audioInput.filter((_device) => _device.deviceId === deviceId);
18958
- if (device && device.length > 0) {
18959
- this.options.uneeqOptions.preferredMicrophoneId = deviceId;
18960
- this.audioConstraints.deviceId = deviceId;
18961
- if (getDevices) {
18962
- this.mediaHandler.publishingStream = false;
18963
- this.getDevices(true);
18964
- }
18965
- this.options.userMessages.next(new __1.SetMicSuccessMessage(deviceId));
18966
- }
18967
- else {
18968
- const msg = 'Uneeq setMic: Error setting device. Device not found.';
18969
- this.options.userMessages.next(new __1.DeviceNotFoundErrorMessage(msg, deviceId));
18970
- }
18971
- }
18972
- setCamDevice(deviceId, getDevices = true) {
18973
- const device = this.devices.videoInput.filter((_device) => _device.deviceId === deviceId);
18974
- if (device && device.length > 0) {
18975
- this.options.uneeqOptions.preferredCameraId = deviceId;
18976
- this.videoConstraints.deviceId = deviceId;
18977
- if (getDevices) {
18978
- this.mediaHandler.publishingStream = false;
18979
- this.getDevices(true);
18980
- }
18981
- this.options.userMessages.next(new __1.SetCameraSuccessMessage(deviceId));
18982
- }
18983
- else {
18984
- const msg = 'Uneeq setCamera: Error setting device. Device not found.';
18985
- this.options.userMessages.next(new __1.DeviceNotFoundErrorMessage(msg, deviceId));
18986
- }
18987
- }
18988
- setAvatarSpeakerDevice(deviceId) {
18989
- if (this.mediaHandler.avatarVideoElement) {
18990
- const device = this.devices.audioOutput.filter((_device) => _device.deviceId === deviceId);
18991
- if (device && device.length > 0) {
18992
- this.options.uneeqOptions.preferredSpeakerId = deviceId;
18993
- this.mediaHandler.avatarVideoElement.setSinkId(deviceId).then(() => {
18994
- this.speakerConstraints.deviceId = deviceId;
18995
- this.options.userMessages.next(new __1.SetSpeakerSuccessMessage(deviceId));
18996
- }).catch((error) => {
18997
- const msg = 'Uneeq setSpeaker: Error setting device. ' + error.message;
18998
- this.options.userMessages.next(new __1.DeviceNotFoundErrorMessage(msg, deviceId));
18999
- });
19000
- }
19001
- else {
19002
- const msg = 'Uneeq setSpeaker: Error setting device. Device not found.';
19003
- this.options.userMessages.next(new __1.DeviceNotFoundErrorMessage(msg, deviceId));
19004
- }
19005
- }
19006
- }
19007
- revertMediaOptions() {
19008
- if (this.previousMediaOptions) {
19009
- this.options.uneeqOptions.sendLocalAudio = this.previousMediaOptions.sendLocalAudio;
19010
- this.options.uneeqOptions.sendLocalVideo = this.previousMediaOptions.sendLocalVideo;
19011
- }
19012
- }
19013
- initMediaConstraints() {
19014
- this.audioConstraints = {};
19015
- this.videoConstraints = { facingMode: 'user', width: 640, height: 480 };
19016
- this.userMediaConstraints = {
19017
- audio: this.options.uneeqOptions.sendLocalAudio ? this.audioConstraints : false,
19018
- video: this.options.uneeqOptions.sendLocalVideo ? this.videoConstraints : false,
19019
- };
19020
- }
19021
- initStreamWithoutDevices() {
19022
- this.publishStream.getTracks().forEach((track) => this.publishStream.removeTrack(track));
19023
- this.publishStream = new MediaStream();
19024
- this.options.internalMessages$.next({ faceMeMessageType: 'DevicePermissionAllowedInternal' });
19025
- this.options.streamManager.addCanvasVideoTrackToStream(this.publishStream);
19026
- this.options.streamManager.addSilentAudioTrackToStream(this.publishStream);
19027
- // setting local stream will trigger a publish/subscribe when edge-node-id is ready
19028
- this.mediaHandler.localStream$.next(this.publishStream);
19029
- }
19030
- remoteVideoReady() {
19031
- if (this.options.uneeqOptions.preferredSpeakerId) {
19032
- this.setAvatarSpeakerDevice(this.options.uneeqOptions.preferredSpeakerId);
19033
- }
19034
- }
19035
- sendMediaUnavailableInfo(hasUserDeniedPermission) {
19036
- return __awaiter(this, void 0, void 0, function* () {
19037
- const deviceList = yield this.getMediaDevices();
19038
- const mediaUnavailableRequest = {
19039
- audioInputs: deviceList.audioInput.length,
19040
- videoInputs: deviceList.videoInput.length,
19041
- hasUserDeniedPermission: hasUserDeniedPermission
19042
- };
19043
- return this.api.sendMediaUnavailable(mediaUnavailableRequest);
19044
- });
19045
- }
19046
- getMediaDevices() {
19047
- return __awaiter(this, void 0, void 0, function* () {
19048
- const devices = yield navigator.mediaDevices.enumerateDevices();
19049
- const deviceList = { audioInput: [], audioOutput: [], videoInput: [] };
19050
- deviceList.audioInput = devices.filter((device) => device.kind === 'audioinput');
19051
- deviceList.audioOutput = devices.filter((device) => device.kind === 'audiooutput');
19052
- deviceList.videoInput = devices.filter((device) => device.kind === 'videoinput');
19053
- return deviceList;
19054
- });
19055
- }
19056
- initDeviceList() {
19057
- return __awaiter(this, void 0, void 0, function* () {
19058
- navigator.mediaDevices.ondevicechange = (e) => { this.initDeviceList(); };
19059
- const deviceList = yield this.getMediaDevices();
19060
- /* We get mediaDevices.ondevicechange multiple times, but some are the same. Check if the device list has changed */
19061
- if (!(JSON.stringify(deviceList) === JSON.stringify(this.devices))) {
19062
- this.devices = deviceList;
19063
- // Set default mic and cam
19064
- if (this.options.uneeqOptions.preferredCameraId) {
19065
- this.setCamDevice(this.options.uneeqOptions.preferredCameraId, false);
19066
- }
19067
- if (this.options.uneeqOptions.preferredMicrophoneId) {
19068
- this.setMicDevice(this.options.uneeqOptions.preferredMicrophoneId, false);
19069
- }
19070
- this.options.userMessages.next(new __1.DeviceListUpdatedMessage(this.devices));
19071
- }
19072
- });
19073
- }
19074
- }
19075
- exports.DeviceManager = DeviceManager;
19076
-
19077
-
19078
- /***/ }),
19079
- /* 230 */
19080
- /***/ (function(module, exports, __webpack_require__) {
19081
-
19082
- "use strict";
19083
-
19084
- Object.defineProperty(exports, "__esModule", { value: true });
19085
- exports.MediaHandler = void 0;
19086
- const rxjs_1 = __webpack_require__(20);
19087
- const __1 = __webpack_require__(0);
19088
- const videoeditor_1 = __webpack_require__(231);
19089
- const PublishSubscribeState_1 = __webpack_require__(234);
19090
- const canvas_service_1 = __webpack_require__(235);
19091
- const logger_1 = __webpack_require__(228);
19092
- const uneeq_webrtc_1 = __webpack_require__(236);
19093
- class MediaHandler {
19094
- /* MediaHandler should not be used until messaging is ready */
19095
- constructor(options, remoteVideoReady) {
19096
- this.options = options;
19097
- this.remoteVideoReady = remoteVideoReady;
19098
- /* Subscribe */
19099
- this.remoteStream$ = new rxjs_1.BehaviorSubject(null);
19100
- /* Publish */
19101
- this.localStream$ = new rxjs_1.BehaviorSubject(null);
19102
- this.publishState$ = new rxjs_1.BehaviorSubject(PublishSubscribeState_1.PublishSubscribeState.DISCONNECTED);
19103
- this.publishingStream = false;
19104
- this.remoteStream$.filter((stream) => stream !== null).subscribe((stream) => {
19105
- const video = document.createElement('video');
19106
- this.avatarVideoElement = video;
19107
- video.srcObject = stream;
19108
- video.volume = 1;
19109
- video.controls = false;
19110
- video.autoplay = false;
19111
- video.setAttribute('playsinline', 'true'); // required for iOS
19112
- video.setAttribute('style', 'object-fit: cover; width: 100%; height: 100%;');
19113
- options.uneeqOptions.avatarVideoContainerElement.style.overflow = 'hidden';
19114
- options.uneeqOptions.avatarVideoContainerElement.innerHTML = '';
19115
- options.uneeqOptions.avatarVideoContainerElement.appendChild(video);
19116
- if (this.options.uneeqOptions.enableTransparentBackground) {
19117
- this.initTransparentBackground(video);
19118
- }
19119
- remoteVideoReady();
19120
- });
19121
- this.localStream$.filter((stream) => stream !== null).subscribe((stream) => {
19122
- const video = document.createElement('video');
19123
- this.localVideoElement = video;
19124
- video.srcObject = stream;
19125
- video.autoplay = true;
19126
- video.muted = true;
19127
- video.setAttribute('playsinline', 'true'); // required for iOS
19128
- video.setAttribute('style', 'width: 100%; height: 100%;');
19129
- options.uneeqOptions.localVideoContainerElement.innerHTML = '';
19130
- options.uneeqOptions.localVideoContainerElement.appendChild(video);
19131
- // provide the users local stream to the voice input manager
19132
- this.options.voiceInputManager.initMicActivity(stream);
19133
- if (this.options.session.edgeNodeId && !this.publishingStream) {
19134
- this.publishVideo();
19135
- }
19136
- });
19137
- // handle the WebRTC messages
19138
- this.options.internalMessages$.filter((message) => message.faceMeMessageType === 'AnswerMessage')
19139
- .subscribe((msg) => {
19140
- if (this.webRTC !== undefined) {
19141
- this.webRTC.handleAnswerMessage(msg);
19142
- }
19143
- });
19144
- this.options.internalMessages$.filter((message) => message.faceMeMessageType === 'IceCandidateMessage')
19145
- .subscribe((msg) => {
19146
- if (this.webRTC !== undefined) {
19147
- this.webRTC.handleIceCandidate(msg);
19148
- }
19149
- });
19150
- }
19151
- setEdgeNodeId(edgeNodeId) {
19152
- this.options.session.edgeNodeId = edgeNodeId;
19153
- if (this.options.session.edgeNodeId && !this.publishingStream && this.localStream$.getValue()) {
19154
- this.publishVideo();
19155
- }
19156
- }
19157
- unpublishVideo() {
19158
- logger_1.logger.log('UserSession | unpublishVideo');
19159
- if (this.webRTC !== undefined) {
19160
- this.webRTC.close();
19161
- this.webRTC = undefined;
19162
- }
19163
- this.publishState$.next(PublishSubscribeState_1.PublishSubscribeState.DISCONNECTED);
19164
- }
19165
- /* Stops local video/audio from sending. Pauses both local and remote video elements */
19166
- pause() {
19167
- const remoteStream = this.remoteStream$.getValue();
19168
- const localStream = this.localStream$.getValue();
19169
- this.avatarVideoElement.pause();
19170
- this.localVideoElement.pause();
19171
- if (localStream) {
19172
- localStream.getTracks().forEach((track) => track.enabled = false);
19173
- }
19174
- if (remoteStream) {
19175
- remoteStream.getTracks().forEach((track) => track.enabled = false);
19176
- }
19177
- }
19178
- /* Starts local video/audio sending if paused. Plays both local and remote video elements */
19179
- resume() {
19180
- const remoteStream = this.remoteStream$.getValue();
19181
- const localStream = this.localStream$.getValue();
19182
- if (localStream) {
19183
- localStream.getTracks().forEach((track) => track.enabled = true);
19184
- }
19185
- if (remoteStream) {
19186
- remoteStream.getTracks().forEach((track) => track.enabled = true);
19187
- }
19188
- this.avatarVideoElement.play();
19189
- this.localVideoElement.play();
19190
- }
19191
- stopAllLocalStreams() {
19192
- const localStream = this.localStream$.getValue();
19193
- if (localStream) {
19194
- localStream.getTracks().forEach((track) => track.stop());
19195
- }
19196
- this.publishingStream = false;
19197
- }
19198
- endSession() {
19199
- // Stop Publish
19200
- this.stopAllLocalStreams();
19201
- if (this.options.uneeqOptions.localVideoContainerElement && this.options.uneeqOptions.localVideoContainerElement) {
19202
- this.options.uneeqOptions.localVideoContainerElement.innerHTML = '';
19203
- }
19204
- this.unpublishVideo();
19205
- // Stop Subscribe
19206
- if (this.options.uneeqOptions.avatarVideoContainerElement && this.options.uneeqOptions.avatarVideoContainerElement) {
19207
- this.options.uneeqOptions.avatarVideoContainerElement.innerHTML = '';
19208
- }
19209
- const remoteStream = this.remoteStream$.getValue();
19210
- if (remoteStream) {
19211
- remoteStream.getTracks().forEach((track) => track.stop());
19212
- }
19213
- this.options.voiceInputManager.handleSessionEnd();
19214
- }
19215
- sendDataMessage(msg) {
19216
- if (this.webRTC) {
19217
- this.webRTC.sendDataMessage(msg);
19218
- }
19219
- }
19220
- gatherWebRTCStats(callback) {
19221
- var _a;
19222
- (_a = this.webRTC) === null || _a === void 0 ? void 0 : _a.getStats(callback);
18604
+ gatherWebRTCStats(callback) {
18605
+ var _a;
18606
+ (_a = this.webRTC) === null || _a === void 0 ? void 0 : _a.getStats(callback);
19223
18607
  }
19224
18608
  publishVideo() {
19225
18609
  const publishStreamName = this.options.session.streamId;
@@ -19303,7 +18687,7 @@ exports.MediaHandler = MediaHandler;
19303
18687
 
19304
18688
 
19305
18689
  /***/ }),
19306
- /* 231 */
18690
+ /* 228 */
19307
18691
  /***/ (function(module, exports, __webpack_require__) {
19308
18692
 
19309
18693
  "use strict";
@@ -19329,12 +18713,12 @@ var __importStar = (this && this.__importStar) || function (mod) {
19329
18713
  };
19330
18714
  Object.defineProperty(exports, "__esModule", { value: true });
19331
18715
  exports.VideoEditor = void 0;
19332
- const Seriously = __importStar(__webpack_require__(232));
18716
+ const Seriously = __importStar(__webpack_require__(229));
19333
18717
  class VideoEditor {
19334
18718
  constructor() { }
19335
18719
  applyChromaKeyEffect(canvas, video) {
19336
18720
  try {
19337
- __webpack_require__(233);
18721
+ __webpack_require__(230);
19338
18722
  const seriously = Seriously.default();
19339
18723
  let reformat;
19340
18724
  let chroma;
@@ -19358,7 +18742,7 @@ exports.VideoEditor = VideoEditor;
19358
18742
 
19359
18743
 
19360
18744
  /***/ }),
19361
- /* 232 */
18745
+ /* 229 */
19362
18746
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
19363
18747
 
19364
18748
  "use strict";
@@ -26099,12 +25483,12 @@ Seriously.util.shader.snoise4d = '#ifndef NOISE4D\n' +
26099
25483
 
26100
25484
 
26101
25485
  /***/ }),
26102
- /* 233 */
25486
+ /* 230 */
26103
25487
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
26104
25488
 
26105
25489
  "use strict";
26106
25490
  __webpack_require__.r(__webpack_exports__);
26107
- /* harmony import */ var _build_seriously_module__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(232);
25491
+ /* harmony import */ var _build_seriously_module__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(229);
26108
25492
  /* global define, require */
26109
25493
 
26110
25494
  'use strict';
@@ -26270,7 +25654,7 @@ _build_seriously_module__WEBPACK_IMPORTED_MODULE_0__["default"].plugin('chroma',
26270
25654
 
26271
25655
 
26272
25656
  /***/ }),
26273
- /* 234 */
25657
+ /* 231 */
26274
25658
  /***/ (function(module, exports, __webpack_require__) {
26275
25659
 
26276
25660
  "use strict";
@@ -26287,7 +25671,7 @@ var PublishSubscribeState;
26287
25671
 
26288
25672
 
26289
25673
  /***/ }),
26290
- /* 235 */
25674
+ /* 232 */
26291
25675
  /***/ (function(module, exports, __webpack_require__) {
26292
25676
 
26293
25677
  "use strict";
@@ -26316,7 +25700,53 @@ exports.CanvasService = CanvasService;
26316
25700
 
26317
25701
 
26318
25702
  /***/ }),
26319
- /* 236 */
25703
+ /* 233 */
25704
+ /***/ (function(module, exports, __webpack_require__) {
25705
+
25706
+ "use strict";
25707
+
25708
+ Object.defineProperty(exports, "__esModule", { value: true });
25709
+ exports.logger = exports.Logger = exports.LogType = void 0;
25710
+ var LogType;
25711
+ (function (LogType) {
25712
+ LogType["debug"] = "debug";
25713
+ LogType["log"] = "log";
25714
+ LogType["warn"] = "warn";
25715
+ LogType["error"] = "error";
25716
+ })(LogType = exports.LogType || (exports.LogType = {}));
25717
+ class Logger {
25718
+ constructor() {
25719
+ this.enabled = false;
25720
+ }
25721
+ log(msg, ...supportingDetails) {
25722
+ this.emitLogMessage(LogType.log, msg, supportingDetails);
25723
+ }
25724
+ warn(msg, ...supportingDetails) {
25725
+ this.emitLogMessage(LogType.warn, msg, supportingDetails);
25726
+ }
25727
+ error(msg, ...supportingDetails) {
25728
+ this.emitLogMessage(LogType.error, msg, supportingDetails);
25729
+ }
25730
+ debug(msg, ...supportingDetails) {
25731
+ this.emitLogMessage(LogType.debug, msg, supportingDetails);
25732
+ }
25733
+ emitLogMessage(msgType, msg, supportingDetails) {
25734
+ if (this.enabled || msgType === LogType.error) {
25735
+ if (supportingDetails.length > 0) {
25736
+ console[msgType](msg, supportingDetails);
25737
+ }
25738
+ else {
25739
+ console[msgType](msg);
25740
+ }
25741
+ }
25742
+ }
25743
+ }
25744
+ exports.Logger = Logger;
25745
+ exports.logger = new Logger();
25746
+
25747
+
25748
+ /***/ }),
25749
+ /* 234 */
26320
25750
  /***/ (function(module, exports, __webpack_require__) {
26321
25751
 
26322
25752
  "use strict";
@@ -26326,10 +25756,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
26326
25756
  };
26327
25757
  Object.defineProperty(exports, "__esModule", { value: true });
26328
25758
  exports.UneeqWebRTC = void 0;
26329
- const simple_peer_1 = __importDefault(__webpack_require__(237));
25759
+ const simple_peer_1 = __importDefault(__webpack_require__(235));
26330
25760
  const webrtc_adapter_1 = __importDefault(__webpack_require__(7));
26331
25761
  const __1 = __webpack_require__(0);
26332
- const logger_1 = __webpack_require__(228);
25762
+ const logger_1 = __webpack_require__(233);
26333
25763
  /**
26334
25764
  * Uneeq WebRTC implementation which hides the complexity of making a WebRTC call.
26335
25765
  */
@@ -26535,16 +25965,16 @@ exports.UneeqWebRTC = UneeqWebRTC;
26535
25965
 
26536
25966
 
26537
25967
  /***/ }),
26538
- /* 237 */
25968
+ /* 235 */
26539
25969
  /***/ (function(module, exports, __webpack_require__) {
26540
25970
 
26541
25971
  /*! simple-peer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
26542
- const debug = __webpack_require__(238)('simple-peer')
26543
- const getBrowserRTC = __webpack_require__(242)
26544
- const randombytes = __webpack_require__(243)
26545
- const stream = __webpack_require__(245)
26546
- const queueMicrotask = __webpack_require__(266) // TODO: remove when Node 10 is not supported
26547
- const errCode = __webpack_require__(267)
25972
+ const debug = __webpack_require__(236)('simple-peer')
25973
+ const getBrowserRTC = __webpack_require__(240)
25974
+ const randombytes = __webpack_require__(241)
25975
+ const stream = __webpack_require__(243)
25976
+ const queueMicrotask = __webpack_require__(264) // TODO: remove when Node 10 is not supported
25977
+ const errCode = __webpack_require__(265)
26548
25978
  const { Buffer } = __webpack_require__(3)
26549
25979
 
26550
25980
  const MAX_BUFFERED_AMOUNT = 64 * 1024
@@ -27593,7 +27023,7 @@ module.exports = Peer
27593
27023
 
27594
27024
 
27595
27025
  /***/ }),
27596
- /* 238 */
27026
+ /* 236 */
27597
27027
  /***/ (function(module, exports, __webpack_require__) {
27598
27028
 
27599
27029
  /* WEBPACK VAR INJECTION */(function(process) {/* eslint-env browser */
@@ -27850,7 +27280,7 @@ function localstorage() {
27850
27280
  }
27851
27281
  }
27852
27282
 
27853
- module.exports = __webpack_require__(240)(exports);
27283
+ module.exports = __webpack_require__(238)(exports);
27854
27284
 
27855
27285
  const {formatters} = module.exports;
27856
27286
 
@@ -27866,10 +27296,10 @@ formatters.j = function (v) {
27866
27296
  }
27867
27297
  };
27868
27298
 
27869
- /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(239)))
27299
+ /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(237)))
27870
27300
 
27871
27301
  /***/ }),
27872
- /* 239 */
27302
+ /* 237 */
27873
27303
  /***/ (function(module, exports) {
27874
27304
 
27875
27305
  // shim for using process in browser
@@ -28059,7 +27489,7 @@ process.umask = function() { return 0; };
28059
27489
 
28060
27490
 
28061
27491
  /***/ }),
28062
- /* 240 */
27492
+ /* 238 */
28063
27493
  /***/ (function(module, exports, __webpack_require__) {
28064
27494
 
28065
27495
 
@@ -28075,7 +27505,7 @@ function setup(env) {
28075
27505
  createDebug.disable = disable;
28076
27506
  createDebug.enable = enable;
28077
27507
  createDebug.enabled = enabled;
28078
- createDebug.humanize = __webpack_require__(241);
27508
+ createDebug.humanize = __webpack_require__(239);
28079
27509
  createDebug.destroy = destroy;
28080
27510
 
28081
27511
  Object.keys(env).forEach(key => {
@@ -28339,7 +27769,7 @@ module.exports = setup;
28339
27769
 
28340
27770
 
28341
27771
  /***/ }),
28342
- /* 241 */
27772
+ /* 239 */
28343
27773
  /***/ (function(module, exports) {
28344
27774
 
28345
27775
  /**
@@ -28507,7 +27937,7 @@ function plural(ms, msAbs, n, name) {
28507
27937
 
28508
27938
 
28509
27939
  /***/ }),
28510
- /* 242 */
27940
+ /* 240 */
28511
27941
  /***/ (function(module, exports) {
28512
27942
 
28513
27943
  // originally pulled out of simple-peer
@@ -28528,7 +27958,7 @@ module.exports = function getBrowserRTC () {
28528
27958
 
28529
27959
 
28530
27960
  /***/ }),
28531
- /* 243 */
27961
+ /* 241 */
28532
27962
  /***/ (function(module, exports, __webpack_require__) {
28533
27963
 
28534
27964
  "use strict";
@@ -28546,7 +27976,7 @@ function oldBrowser () {
28546
27976
  throw new Error('Secure random number generation is not supported by this browser.\nUse Chrome, Firefox or Internet Explorer 11')
28547
27977
  }
28548
27978
 
28549
- var Buffer = __webpack_require__(244).Buffer
27979
+ var Buffer = __webpack_require__(242).Buffer
28550
27980
  var crypto = global.crypto || global.msCrypto
28551
27981
 
28552
27982
  if (crypto && crypto.getRandomValues) {
@@ -28583,10 +28013,10 @@ function randomBytes (size, cb) {
28583
28013
  return bytes
28584
28014
  }
28585
28015
 
28586
- /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(2), __webpack_require__(239)))
28016
+ /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(2), __webpack_require__(237)))
28587
28017
 
28588
28018
  /***/ }),
28589
- /* 244 */
28019
+ /* 242 */
28590
28020
  /***/ (function(module, exports, __webpack_require__) {
28591
28021
 
28592
28022
  /*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
@@ -28657,22 +28087,22 @@ SafeBuffer.allocUnsafeSlow = function (size) {
28657
28087
 
28658
28088
 
28659
28089
  /***/ }),
28660
- /* 245 */
28090
+ /* 243 */
28661
28091
  /***/ (function(module, exports, __webpack_require__) {
28662
28092
 
28663
- exports = module.exports = __webpack_require__(246);
28093
+ exports = module.exports = __webpack_require__(244);
28664
28094
  exports.Stream = exports;
28665
28095
  exports.Readable = exports;
28666
- exports.Writable = __webpack_require__(257);
28667
- exports.Duplex = __webpack_require__(256);
28668
- exports.Transform = __webpack_require__(263);
28669
- exports.PassThrough = __webpack_require__(264);
28670
- exports.finished = __webpack_require__(261);
28671
- exports.pipeline = __webpack_require__(265);
28096
+ exports.Writable = __webpack_require__(255);
28097
+ exports.Duplex = __webpack_require__(254);
28098
+ exports.Transform = __webpack_require__(261);
28099
+ exports.PassThrough = __webpack_require__(262);
28100
+ exports.finished = __webpack_require__(259);
28101
+ exports.pipeline = __webpack_require__(263);
28672
28102
 
28673
28103
 
28674
28104
  /***/ }),
28675
- /* 246 */
28105
+ /* 244 */
28676
28106
  /***/ (function(module, exports, __webpack_require__) {
28677
28107
 
28678
28108
  "use strict";
@@ -28707,7 +28137,7 @@ var Duplex;
28707
28137
  Readable.ReadableState = ReadableState;
28708
28138
  /*<replacement>*/
28709
28139
 
28710
- var EE = __webpack_require__(247).EventEmitter;
28140
+ var EE = __webpack_require__(245).EventEmitter;
28711
28141
 
28712
28142
  var EElistenerCount = function EElistenerCount(emitter, type) {
28713
28143
  return emitter.listeners(type).length;
@@ -28717,7 +28147,7 @@ var EElistenerCount = function EElistenerCount(emitter, type) {
28717
28147
  /*<replacement>*/
28718
28148
 
28719
28149
 
28720
- var Stream = __webpack_require__(248);
28150
+ var Stream = __webpack_require__(246);
28721
28151
  /*</replacement>*/
28722
28152
 
28723
28153
 
@@ -28735,7 +28165,7 @@ function _isUint8Array(obj) {
28735
28165
  /*<replacement>*/
28736
28166
 
28737
28167
 
28738
- var debugUtil = __webpack_require__(249);
28168
+ var debugUtil = __webpack_require__(247);
28739
28169
 
28740
28170
  var debug;
28741
28171
 
@@ -28747,14 +28177,14 @@ if (debugUtil && debugUtil.debuglog) {
28747
28177
  /*</replacement>*/
28748
28178
 
28749
28179
 
28750
- var BufferList = __webpack_require__(250);
28180
+ var BufferList = __webpack_require__(248);
28751
28181
 
28752
- var destroyImpl = __webpack_require__(252);
28182
+ var destroyImpl = __webpack_require__(250);
28753
28183
 
28754
- var _require = __webpack_require__(253),
28184
+ var _require = __webpack_require__(251),
28755
28185
  getHighWaterMark = _require.getHighWaterMark;
28756
28186
 
28757
- var _require$codes = __webpack_require__(254).codes,
28187
+ var _require$codes = __webpack_require__(252).codes,
28758
28188
  ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE,
28759
28189
  ERR_STREAM_PUSH_AFTER_EOF = _require$codes.ERR_STREAM_PUSH_AFTER_EOF,
28760
28190
  ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED,
@@ -28765,7 +28195,7 @@ var StringDecoder;
28765
28195
  var createReadableStreamAsyncIterator;
28766
28196
  var from;
28767
28197
 
28768
- __webpack_require__(255)(Readable, Stream);
28198
+ __webpack_require__(253)(Readable, Stream);
28769
28199
 
28770
28200
  var errorOrDestroy = destroyImpl.errorOrDestroy;
28771
28201
  var kProxyEvents = ['error', 'close', 'destroy', 'pause', 'resume'];
@@ -28782,7 +28212,7 @@ function prependListener(emitter, event, fn) {
28782
28212
  }
28783
28213
 
28784
28214
  function ReadableState(options, stream, isDuplex) {
28785
- Duplex = Duplex || __webpack_require__(256);
28215
+ Duplex = Duplex || __webpack_require__(254);
28786
28216
  options = options || {}; // Duplex streams are both readable and writable, but share
28787
28217
  // the same options object.
28788
28218
  // However, some cases require setting options to different
@@ -28838,14 +28268,14 @@ function ReadableState(options, stream, isDuplex) {
28838
28268
  this.encoding = null;
28839
28269
 
28840
28270
  if (options.encoding) {
28841
- if (!StringDecoder) StringDecoder = __webpack_require__(259).StringDecoder;
28271
+ if (!StringDecoder) StringDecoder = __webpack_require__(257).StringDecoder;
28842
28272
  this.decoder = new StringDecoder(options.encoding);
28843
28273
  this.encoding = options.encoding;
28844
28274
  }
28845
28275
  }
28846
28276
 
28847
28277
  function Readable(options) {
28848
- Duplex = Duplex || __webpack_require__(256);
28278
+ Duplex = Duplex || __webpack_require__(254);
28849
28279
  if (!(this instanceof Readable)) return new Readable(options); // Checking for a Stream.Duplex instance is faster here instead of inside
28850
28280
  // the ReadableState constructor, at least with V8 6.5
28851
28281
 
@@ -29000,7 +28430,7 @@ Readable.prototype.isPaused = function () {
29000
28430
 
29001
28431
 
29002
28432
  Readable.prototype.setEncoding = function (enc) {
29003
- if (!StringDecoder) StringDecoder = __webpack_require__(259).StringDecoder;
28433
+ if (!StringDecoder) StringDecoder = __webpack_require__(257).StringDecoder;
29004
28434
  var decoder = new StringDecoder(enc);
29005
28435
  this._readableState.decoder = decoder; // If setEncoding(null), decoder.encoding equals utf8
29006
28436
 
@@ -29684,7 +29114,7 @@ Readable.prototype.wrap = function (stream) {
29684
29114
  if (typeof Symbol === 'function') {
29685
29115
  Readable.prototype[Symbol.asyncIterator] = function () {
29686
29116
  if (createReadableStreamAsyncIterator === undefined) {
29687
- createReadableStreamAsyncIterator = __webpack_require__(260);
29117
+ createReadableStreamAsyncIterator = __webpack_require__(258);
29688
29118
  }
29689
29119
 
29690
29120
  return createReadableStreamAsyncIterator(this);
@@ -29786,7 +29216,7 @@ function endReadableNT(state, stream) {
29786
29216
  if (typeof Symbol === 'function') {
29787
29217
  Readable.from = function (iterable, opts) {
29788
29218
  if (from === undefined) {
29789
- from = __webpack_require__(262);
29219
+ from = __webpack_require__(260);
29790
29220
  }
29791
29221
 
29792
29222
  return from(Readable, iterable, opts);
@@ -29800,10 +29230,10 @@ function indexOf(xs, x) {
29800
29230
 
29801
29231
  return -1;
29802
29232
  }
29803
- /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(2), __webpack_require__(239)))
29233
+ /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(2), __webpack_require__(237)))
29804
29234
 
29805
29235
  /***/ }),
29806
- /* 247 */
29236
+ /* 245 */
29807
29237
  /***/ (function(module, exports, __webpack_require__) {
29808
29238
 
29809
29239
  "use strict";
@@ -30307,20 +29737,20 @@ function eventTargetAgnosticAddListener(emitter, name, listener, flags) {
30307
29737
 
30308
29738
 
30309
29739
  /***/ }),
30310
- /* 248 */
29740
+ /* 246 */
30311
29741
  /***/ (function(module, exports, __webpack_require__) {
30312
29742
 
30313
- module.exports = __webpack_require__(247).EventEmitter;
29743
+ module.exports = __webpack_require__(245).EventEmitter;
30314
29744
 
30315
29745
 
30316
29746
  /***/ }),
30317
- /* 249 */
29747
+ /* 247 */
30318
29748
  /***/ (function(module, exports) {
30319
29749
 
30320
29750
  /* (ignored) */
30321
29751
 
30322
29752
  /***/ }),
30323
- /* 250 */
29753
+ /* 248 */
30324
29754
  /***/ (function(module, exports, __webpack_require__) {
30325
29755
 
30326
29756
  "use strict";
@@ -30341,7 +29771,7 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
30341
29771
  var _require = __webpack_require__(3),
30342
29772
  Buffer = _require.Buffer;
30343
29773
 
30344
- var _require2 = __webpack_require__(251),
29774
+ var _require2 = __webpack_require__(249),
30345
29775
  inspect = _require2.inspect;
30346
29776
 
30347
29777
  var custom = inspect && inspect.custom || 'inspect';
@@ -30536,13 +29966,13 @@ function () {
30536
29966
  }();
30537
29967
 
30538
29968
  /***/ }),
30539
- /* 251 */
29969
+ /* 249 */
30540
29970
  /***/ (function(module, exports) {
30541
29971
 
30542
29972
  /* (ignored) */
30543
29973
 
30544
29974
  /***/ }),
30545
- /* 252 */
29975
+ /* 250 */
30546
29976
  /***/ (function(module, exports, __webpack_require__) {
30547
29977
 
30548
29978
  "use strict";
@@ -30651,16 +30081,16 @@ module.exports = {
30651
30081
  undestroy: undestroy,
30652
30082
  errorOrDestroy: errorOrDestroy
30653
30083
  };
30654
- /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(239)))
30084
+ /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(237)))
30655
30085
 
30656
30086
  /***/ }),
30657
- /* 253 */
30087
+ /* 251 */
30658
30088
  /***/ (function(module, exports, __webpack_require__) {
30659
30089
 
30660
30090
  "use strict";
30661
30091
 
30662
30092
 
30663
- var ERR_INVALID_OPT_VALUE = __webpack_require__(254).codes.ERR_INVALID_OPT_VALUE;
30093
+ var ERR_INVALID_OPT_VALUE = __webpack_require__(252).codes.ERR_INVALID_OPT_VALUE;
30664
30094
 
30665
30095
  function highWaterMarkFrom(options, isDuplex, duplexKey) {
30666
30096
  return options.highWaterMark != null ? options.highWaterMark : isDuplex ? options[duplexKey] : null;
@@ -30687,7 +30117,7 @@ module.exports = {
30687
30117
  };
30688
30118
 
30689
30119
  /***/ }),
30690
- /* 254 */
30120
+ /* 252 */
30691
30121
  /***/ (function(module, exports, __webpack_require__) {
30692
30122
 
30693
30123
  "use strict";
@@ -30821,7 +30251,7 @@ module.exports.codes = codes;
30821
30251
 
30822
30252
 
30823
30253
  /***/ }),
30824
- /* 255 */
30254
+ /* 253 */
30825
30255
  /***/ (function(module, exports) {
30826
30256
 
30827
30257
  if (typeof Object.create === 'function') {
@@ -30854,7 +30284,7 @@ if (typeof Object.create === 'function') {
30854
30284
 
30855
30285
 
30856
30286
  /***/ }),
30857
- /* 256 */
30287
+ /* 254 */
30858
30288
  /***/ (function(module, exports, __webpack_require__) {
30859
30289
 
30860
30290
  "use strict";
@@ -30899,11 +30329,11 @@ var objectKeys = Object.keys || function (obj) {
30899
30329
 
30900
30330
  module.exports = Duplex;
30901
30331
 
30902
- var Readable = __webpack_require__(246);
30332
+ var Readable = __webpack_require__(244);
30903
30333
 
30904
- var Writable = __webpack_require__(257);
30334
+ var Writable = __webpack_require__(255);
30905
30335
 
30906
- __webpack_require__(255)(Duplex, Readable);
30336
+ __webpack_require__(253)(Duplex, Readable);
30907
30337
 
30908
30338
  {
30909
30339
  // Allow the keys array to be GC'ed.
@@ -30997,10 +30427,10 @@ Object.defineProperty(Duplex.prototype, 'destroyed', {
30997
30427
  this._writableState.destroyed = value;
30998
30428
  }
30999
30429
  });
31000
- /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(239)))
30430
+ /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(237)))
31001
30431
 
31002
30432
  /***/ }),
31003
- /* 257 */
30433
+ /* 255 */
31004
30434
  /***/ (function(module, exports, __webpack_require__) {
31005
30435
 
31006
30436
  "use strict";
@@ -31063,13 +30493,13 @@ Writable.WritableState = WritableState;
31063
30493
  /*<replacement>*/
31064
30494
 
31065
30495
  var internalUtil = {
31066
- deprecate: __webpack_require__(258)
30496
+ deprecate: __webpack_require__(256)
31067
30497
  };
31068
30498
  /*</replacement>*/
31069
30499
 
31070
30500
  /*<replacement>*/
31071
30501
 
31072
- var Stream = __webpack_require__(248);
30502
+ var Stream = __webpack_require__(246);
31073
30503
  /*</replacement>*/
31074
30504
 
31075
30505
 
@@ -31085,12 +30515,12 @@ function _isUint8Array(obj) {
31085
30515
  return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;
31086
30516
  }
31087
30517
 
31088
- var destroyImpl = __webpack_require__(252);
30518
+ var destroyImpl = __webpack_require__(250);
31089
30519
 
31090
- var _require = __webpack_require__(253),
30520
+ var _require = __webpack_require__(251),
31091
30521
  getHighWaterMark = _require.getHighWaterMark;
31092
30522
 
31093
- var _require$codes = __webpack_require__(254).codes,
30523
+ var _require$codes = __webpack_require__(252).codes,
31094
30524
  ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE,
31095
30525
  ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED,
31096
30526
  ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK,
@@ -31102,12 +30532,12 @@ var _require$codes = __webpack_require__(254).codes,
31102
30532
 
31103
30533
  var errorOrDestroy = destroyImpl.errorOrDestroy;
31104
30534
 
31105
- __webpack_require__(255)(Writable, Stream);
30535
+ __webpack_require__(253)(Writable, Stream);
31106
30536
 
31107
30537
  function nop() {}
31108
30538
 
31109
30539
  function WritableState(options, stream, isDuplex) {
31110
- Duplex = Duplex || __webpack_require__(256);
30540
+ Duplex = Duplex || __webpack_require__(254);
31111
30541
  options = options || {}; // Duplex streams are both readable and writable, but share
31112
30542
  // the same options object.
31113
30543
  // However, some cases require setting options to different
@@ -31233,7 +30663,7 @@ if (typeof Symbol === 'function' && Symbol.hasInstance && typeof Function.protot
31233
30663
  }
31234
30664
 
31235
30665
  function Writable(options) {
31236
- Duplex = Duplex || __webpack_require__(256); // Writable ctor is applied to Duplexes, too.
30666
+ Duplex = Duplex || __webpack_require__(254); // Writable ctor is applied to Duplexes, too.
31237
30667
  // `realHasInstance` is necessary because using plain `instanceof`
31238
30668
  // would return false, as no `_writableState` property is attached.
31239
30669
  // Trying to use the custom `instanceof` for Writable here will also break the
@@ -31701,10 +31131,10 @@ Writable.prototype._undestroy = destroyImpl.undestroy;
31701
31131
  Writable.prototype._destroy = function (err, cb) {
31702
31132
  cb(err);
31703
31133
  };
31704
- /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(2), __webpack_require__(239)))
31134
+ /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(2), __webpack_require__(237)))
31705
31135
 
31706
31136
  /***/ }),
31707
- /* 258 */
31137
+ /* 256 */
31708
31138
  /***/ (function(module, exports, __webpack_require__) {
31709
31139
 
31710
31140
  /* WEBPACK VAR INJECTION */(function(global) {
@@ -31778,7 +31208,7 @@ function config (name) {
31778
31208
  /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(2)))
31779
31209
 
31780
31210
  /***/ }),
31781
- /* 259 */
31211
+ /* 257 */
31782
31212
  /***/ (function(module, exports, __webpack_require__) {
31783
31213
 
31784
31214
  "use strict";
@@ -31807,7 +31237,7 @@ function config (name) {
31807
31237
 
31808
31238
  /*<replacement>*/
31809
31239
 
31810
- var Buffer = __webpack_require__(244).Buffer;
31240
+ var Buffer = __webpack_require__(242).Buffer;
31811
31241
  /*</replacement>*/
31812
31242
 
31813
31243
  var isEncoding = Buffer.isEncoding || function (encoding) {
@@ -32080,7 +31510,7 @@ function simpleEnd(buf) {
32080
31510
  }
32081
31511
 
32082
31512
  /***/ }),
32083
- /* 260 */
31513
+ /* 258 */
32084
31514
  /***/ (function(module, exports, __webpack_require__) {
32085
31515
 
32086
31516
  "use strict";
@@ -32090,7 +31520,7 @@ var _Object$setPrototypeO;
32090
31520
 
32091
31521
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
32092
31522
 
32093
- var finished = __webpack_require__(261);
31523
+ var finished = __webpack_require__(259);
32094
31524
 
32095
31525
  var kLastResolve = Symbol('lastResolve');
32096
31526
  var kLastReject = Symbol('lastReject');
@@ -32291,10 +31721,10 @@ var createReadableStreamAsyncIterator = function createReadableStreamAsyncIterat
32291
31721
  };
32292
31722
 
32293
31723
  module.exports = createReadableStreamAsyncIterator;
32294
- /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(239)))
31724
+ /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(237)))
32295
31725
 
32296
31726
  /***/ }),
32297
- /* 261 */
31727
+ /* 259 */
32298
31728
  /***/ (function(module, exports, __webpack_require__) {
32299
31729
 
32300
31730
  "use strict";
@@ -32302,7 +31732,7 @@ module.exports = createReadableStreamAsyncIterator;
32302
31732
  // permission from the author, Mathias Buus (@mafintosh).
32303
31733
 
32304
31734
 
32305
- var ERR_STREAM_PREMATURE_CLOSE = __webpack_require__(254).codes.ERR_STREAM_PREMATURE_CLOSE;
31735
+ var ERR_STREAM_PREMATURE_CLOSE = __webpack_require__(252).codes.ERR_STREAM_PREMATURE_CLOSE;
32306
31736
 
32307
31737
  function once(callback) {
32308
31738
  var called = false;
@@ -32345,518 +31775,1088 @@ function eos(stream, opts, callback) {
32345
31775
 
32346
31776
  var readableEnded = stream._readableState && stream._readableState.endEmitted;
32347
31777
 
32348
- var onend = function onend() {
32349
- readable = false;
32350
- readableEnded = true;
32351
- if (!writable) callback.call(stream);
32352
- };
31778
+ var onend = function onend() {
31779
+ readable = false;
31780
+ readableEnded = true;
31781
+ if (!writable) callback.call(stream);
31782
+ };
31783
+
31784
+ var onerror = function onerror(err) {
31785
+ callback.call(stream, err);
31786
+ };
31787
+
31788
+ var onclose = function onclose() {
31789
+ var err;
31790
+
31791
+ if (readable && !readableEnded) {
31792
+ if (!stream._readableState || !stream._readableState.ended) err = new ERR_STREAM_PREMATURE_CLOSE();
31793
+ return callback.call(stream, err);
31794
+ }
31795
+
31796
+ if (writable && !writableEnded) {
31797
+ if (!stream._writableState || !stream._writableState.ended) err = new ERR_STREAM_PREMATURE_CLOSE();
31798
+ return callback.call(stream, err);
31799
+ }
31800
+ };
31801
+
31802
+ var onrequest = function onrequest() {
31803
+ stream.req.on('finish', onfinish);
31804
+ };
31805
+
31806
+ if (isRequest(stream)) {
31807
+ stream.on('complete', onfinish);
31808
+ stream.on('abort', onclose);
31809
+ if (stream.req) onrequest();else stream.on('request', onrequest);
31810
+ } else if (writable && !stream._writableState) {
31811
+ // legacy streams
31812
+ stream.on('end', onlegacyfinish);
31813
+ stream.on('close', onlegacyfinish);
31814
+ }
31815
+
31816
+ stream.on('end', onend);
31817
+ stream.on('finish', onfinish);
31818
+ if (opts.error !== false) stream.on('error', onerror);
31819
+ stream.on('close', onclose);
31820
+ return function () {
31821
+ stream.removeListener('complete', onfinish);
31822
+ stream.removeListener('abort', onclose);
31823
+ stream.removeListener('request', onrequest);
31824
+ if (stream.req) stream.req.removeListener('finish', onfinish);
31825
+ stream.removeListener('end', onlegacyfinish);
31826
+ stream.removeListener('close', onlegacyfinish);
31827
+ stream.removeListener('finish', onfinish);
31828
+ stream.removeListener('end', onend);
31829
+ stream.removeListener('error', onerror);
31830
+ stream.removeListener('close', onclose);
31831
+ };
31832
+ }
31833
+
31834
+ module.exports = eos;
31835
+
31836
+ /***/ }),
31837
+ /* 260 */
31838
+ /***/ (function(module, exports) {
31839
+
31840
+ module.exports = function () {
31841
+ throw new Error('Readable.from is not available in the browser')
31842
+ };
31843
+
31844
+
31845
+ /***/ }),
31846
+ /* 261 */
31847
+ /***/ (function(module, exports, __webpack_require__) {
31848
+
31849
+ "use strict";
31850
+ // Copyright Joyent, Inc. and other Node contributors.
31851
+ //
31852
+ // Permission is hereby granted, free of charge, to any person obtaining a
31853
+ // copy of this software and associated documentation files (the
31854
+ // "Software"), to deal in the Software without restriction, including
31855
+ // without limitation the rights to use, copy, modify, merge, publish,
31856
+ // distribute, sublicense, and/or sell copies of the Software, and to permit
31857
+ // persons to whom the Software is furnished to do so, subject to the
31858
+ // following conditions:
31859
+ //
31860
+ // The above copyright notice and this permission notice shall be included
31861
+ // in all copies or substantial portions of the Software.
31862
+ //
31863
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
31864
+ // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
31865
+ // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
31866
+ // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
31867
+ // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
31868
+ // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
31869
+ // USE OR OTHER DEALINGS IN THE SOFTWARE.
31870
+ // a transform stream is a readable/writable stream where you do
31871
+ // something with the data. Sometimes it's called a "filter",
31872
+ // but that's not a great name for it, since that implies a thing where
31873
+ // some bits pass through, and others are simply ignored. (That would
31874
+ // be a valid example of a transform, of course.)
31875
+ //
31876
+ // While the output is causally related to the input, it's not a
31877
+ // necessarily symmetric or synchronous transformation. For example,
31878
+ // a zlib stream might take multiple plain-text writes(), and then
31879
+ // emit a single compressed chunk some time in the future.
31880
+ //
31881
+ // Here's how this works:
31882
+ //
31883
+ // The Transform stream has all the aspects of the readable and writable
31884
+ // stream classes. When you write(chunk), that calls _write(chunk,cb)
31885
+ // internally, and returns false if there's a lot of pending writes
31886
+ // buffered up. When you call read(), that calls _read(n) until
31887
+ // there's enough pending readable data buffered up.
31888
+ //
31889
+ // In a transform stream, the written data is placed in a buffer. When
31890
+ // _read(n) is called, it transforms the queued up data, calling the
31891
+ // buffered _write cb's as it consumes chunks. If consuming a single
31892
+ // written chunk would result in multiple output chunks, then the first
31893
+ // outputted bit calls the readcb, and subsequent chunks just go into
31894
+ // the read buffer, and will cause it to emit 'readable' if necessary.
31895
+ //
31896
+ // This way, back-pressure is actually determined by the reading side,
31897
+ // since _read has to be called to start processing a new chunk. However,
31898
+ // a pathological inflate type of transform can cause excessive buffering
31899
+ // here. For example, imagine a stream where every byte of input is
31900
+ // interpreted as an integer from 0-255, and then results in that many
31901
+ // bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in
31902
+ // 1kb of data being output. In this case, you could write a very small
31903
+ // amount of input, and end up with a very large amount of output. In
31904
+ // such a pathological inflating mechanism, there'd be no way to tell
31905
+ // the system to stop doing the transform. A single 4MB write could
31906
+ // cause the system to run out of memory.
31907
+ //
31908
+ // However, even in such a pathological case, only a single written chunk
31909
+ // would be consumed, and then the rest would wait (un-transformed) until
31910
+ // the results of the previous transformed chunk were consumed.
31911
+
31912
+
31913
+ module.exports = Transform;
31914
+
31915
+ var _require$codes = __webpack_require__(252).codes,
31916
+ ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED,
31917
+ ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK,
31918
+ ERR_TRANSFORM_ALREADY_TRANSFORMING = _require$codes.ERR_TRANSFORM_ALREADY_TRANSFORMING,
31919
+ ERR_TRANSFORM_WITH_LENGTH_0 = _require$codes.ERR_TRANSFORM_WITH_LENGTH_0;
31920
+
31921
+ var Duplex = __webpack_require__(254);
31922
+
31923
+ __webpack_require__(253)(Transform, Duplex);
31924
+
31925
+ function afterTransform(er, data) {
31926
+ var ts = this._transformState;
31927
+ ts.transforming = false;
31928
+ var cb = ts.writecb;
31929
+
31930
+ if (cb === null) {
31931
+ return this.emit('error', new ERR_MULTIPLE_CALLBACK());
31932
+ }
31933
+
31934
+ ts.writechunk = null;
31935
+ ts.writecb = null;
31936
+ if (data != null) // single equals check for both `null` and `undefined`
31937
+ this.push(data);
31938
+ cb(er);
31939
+ var rs = this._readableState;
31940
+ rs.reading = false;
31941
+
31942
+ if (rs.needReadable || rs.length < rs.highWaterMark) {
31943
+ this._read(rs.highWaterMark);
31944
+ }
31945
+ }
31946
+
31947
+ function Transform(options) {
31948
+ if (!(this instanceof Transform)) return new Transform(options);
31949
+ Duplex.call(this, options);
31950
+ this._transformState = {
31951
+ afterTransform: afterTransform.bind(this),
31952
+ needTransform: false,
31953
+ transforming: false,
31954
+ writecb: null,
31955
+ writechunk: null,
31956
+ writeencoding: null
31957
+ }; // start out asking for a readable event once data is transformed.
31958
+
31959
+ this._readableState.needReadable = true; // we have implemented the _read method, and done the other things
31960
+ // that Readable wants before the first _read call, so unset the
31961
+ // sync guard flag.
31962
+
31963
+ this._readableState.sync = false;
31964
+
31965
+ if (options) {
31966
+ if (typeof options.transform === 'function') this._transform = options.transform;
31967
+ if (typeof options.flush === 'function') this._flush = options.flush;
31968
+ } // When the writable side finishes, then flush out anything remaining.
31969
+
31970
+
31971
+ this.on('prefinish', prefinish);
31972
+ }
31973
+
31974
+ function prefinish() {
31975
+ var _this = this;
31976
+
31977
+ if (typeof this._flush === 'function' && !this._readableState.destroyed) {
31978
+ this._flush(function (er, data) {
31979
+ done(_this, er, data);
31980
+ });
31981
+ } else {
31982
+ done(this, null, null);
31983
+ }
31984
+ }
31985
+
31986
+ Transform.prototype.push = function (chunk, encoding) {
31987
+ this._transformState.needTransform = false;
31988
+ return Duplex.prototype.push.call(this, chunk, encoding);
31989
+ }; // This is the part where you do stuff!
31990
+ // override this function in implementation classes.
31991
+ // 'chunk' is an input chunk.
31992
+ //
31993
+ // Call `push(newChunk)` to pass along transformed output
31994
+ // to the readable side. You may call 'push' zero or more times.
31995
+ //
31996
+ // Call `cb(err)` when you are done with this chunk. If you pass
31997
+ // an error, then that'll put the hurt on the whole operation. If you
31998
+ // never call cb(), then you'll never get another chunk.
31999
+
32000
+
32001
+ Transform.prototype._transform = function (chunk, encoding, cb) {
32002
+ cb(new ERR_METHOD_NOT_IMPLEMENTED('_transform()'));
32003
+ };
32004
+
32005
+ Transform.prototype._write = function (chunk, encoding, cb) {
32006
+ var ts = this._transformState;
32007
+ ts.writecb = cb;
32008
+ ts.writechunk = chunk;
32009
+ ts.writeencoding = encoding;
32010
+
32011
+ if (!ts.transforming) {
32012
+ var rs = this._readableState;
32013
+ if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark);
32014
+ }
32015
+ }; // Doesn't matter what the args are here.
32016
+ // _transform does all the work.
32017
+ // That we got here means that the readable side wants more data.
32018
+
32019
+
32020
+ Transform.prototype._read = function (n) {
32021
+ var ts = this._transformState;
32022
+
32023
+ if (ts.writechunk !== null && !ts.transforming) {
32024
+ ts.transforming = true;
32025
+
32026
+ this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);
32027
+ } else {
32028
+ // mark that we need a transform, so that any data that comes in
32029
+ // will get processed, now that we've asked for it.
32030
+ ts.needTransform = true;
32031
+ }
32032
+ };
32033
+
32034
+ Transform.prototype._destroy = function (err, cb) {
32035
+ Duplex.prototype._destroy.call(this, err, function (err2) {
32036
+ cb(err2);
32037
+ });
32038
+ };
32039
+
32040
+ function done(stream, er, data) {
32041
+ if (er) return stream.emit('error', er);
32042
+ if (data != null) // single equals check for both `null` and `undefined`
32043
+ stream.push(data); // TODO(BridgeAR): Write a test for these two error cases
32044
+ // if there's nothing in the write buffer, then that means
32045
+ // that nothing more will ever be provided
32046
+
32047
+ if (stream._writableState.length) throw new ERR_TRANSFORM_WITH_LENGTH_0();
32048
+ if (stream._transformState.transforming) throw new ERR_TRANSFORM_ALREADY_TRANSFORMING();
32049
+ return stream.push(null);
32050
+ }
32051
+
32052
+ /***/ }),
32053
+ /* 262 */
32054
+ /***/ (function(module, exports, __webpack_require__) {
32055
+
32056
+ "use strict";
32057
+ // Copyright Joyent, Inc. and other Node contributors.
32058
+ //
32059
+ // Permission is hereby granted, free of charge, to any person obtaining a
32060
+ // copy of this software and associated documentation files (the
32061
+ // "Software"), to deal in the Software without restriction, including
32062
+ // without limitation the rights to use, copy, modify, merge, publish,
32063
+ // distribute, sublicense, and/or sell copies of the Software, and to permit
32064
+ // persons to whom the Software is furnished to do so, subject to the
32065
+ // following conditions:
32066
+ //
32067
+ // The above copyright notice and this permission notice shall be included
32068
+ // in all copies or substantial portions of the Software.
32069
+ //
32070
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
32071
+ // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
32072
+ // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
32073
+ // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
32074
+ // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
32075
+ // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
32076
+ // USE OR OTHER DEALINGS IN THE SOFTWARE.
32077
+ // a passthrough stream.
32078
+ // basically just the most minimal sort of Transform stream.
32079
+ // Every written chunk gets output as-is.
32080
+
32081
+
32082
+ module.exports = PassThrough;
32083
+
32084
+ var Transform = __webpack_require__(261);
32085
+
32086
+ __webpack_require__(253)(PassThrough, Transform);
32087
+
32088
+ function PassThrough(options) {
32089
+ if (!(this instanceof PassThrough)) return new PassThrough(options);
32090
+ Transform.call(this, options);
32091
+ }
32092
+
32093
+ PassThrough.prototype._transform = function (chunk, encoding, cb) {
32094
+ cb(null, chunk);
32095
+ };
32096
+
32097
+ /***/ }),
32098
+ /* 263 */
32099
+ /***/ (function(module, exports, __webpack_require__) {
32100
+
32101
+ "use strict";
32102
+ // Ported from https://github.com/mafintosh/pump with
32103
+ // permission from the author, Mathias Buus (@mafintosh).
32104
+
32105
+
32106
+ var eos;
32107
+
32108
+ function once(callback) {
32109
+ var called = false;
32110
+ return function () {
32111
+ if (called) return;
32112
+ called = true;
32113
+ callback.apply(void 0, arguments);
32114
+ };
32115
+ }
32116
+
32117
+ var _require$codes = __webpack_require__(252).codes,
32118
+ ERR_MISSING_ARGS = _require$codes.ERR_MISSING_ARGS,
32119
+ ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED;
32120
+
32121
+ function noop(err) {
32122
+ // Rethrow the error if it exists to avoid swallowing it
32123
+ if (err) throw err;
32124
+ }
32125
+
32126
+ function isRequest(stream) {
32127
+ return stream.setHeader && typeof stream.abort === 'function';
32128
+ }
32129
+
32130
+ function destroyer(stream, reading, writing, callback) {
32131
+ callback = once(callback);
32132
+ var closed = false;
32133
+ stream.on('close', function () {
32134
+ closed = true;
32135
+ });
32136
+ if (eos === undefined) eos = __webpack_require__(259);
32137
+ eos(stream, {
32138
+ readable: reading,
32139
+ writable: writing
32140
+ }, function (err) {
32141
+ if (err) return callback(err);
32142
+ closed = true;
32143
+ callback();
32144
+ });
32145
+ var destroyed = false;
32146
+ return function (err) {
32147
+ if (closed) return;
32148
+ if (destroyed) return;
32149
+ destroyed = true; // request.destroy just do .end - .abort is what we want
32150
+
32151
+ if (isRequest(stream)) return stream.abort();
32152
+ if (typeof stream.destroy === 'function') return stream.destroy();
32153
+ callback(err || new ERR_STREAM_DESTROYED('pipe'));
32154
+ };
32155
+ }
32156
+
32157
+ function call(fn) {
32158
+ fn();
32159
+ }
32160
+
32161
+ function pipe(from, to) {
32162
+ return from.pipe(to);
32163
+ }
32164
+
32165
+ function popCallback(streams) {
32166
+ if (!streams.length) return noop;
32167
+ if (typeof streams[streams.length - 1] !== 'function') return noop;
32168
+ return streams.pop();
32169
+ }
32170
+
32171
+ function pipeline() {
32172
+ for (var _len = arguments.length, streams = new Array(_len), _key = 0; _key < _len; _key++) {
32173
+ streams[_key] = arguments[_key];
32174
+ }
32175
+
32176
+ var callback = popCallback(streams);
32177
+ if (Array.isArray(streams[0])) streams = streams[0];
32178
+
32179
+ if (streams.length < 2) {
32180
+ throw new ERR_MISSING_ARGS('streams');
32181
+ }
32182
+
32183
+ var error;
32184
+ var destroys = streams.map(function (stream, i) {
32185
+ var reading = i < streams.length - 1;
32186
+ var writing = i > 0;
32187
+ return destroyer(stream, reading, writing, function (err) {
32188
+ if (!error) error = err;
32189
+ if (err) destroys.forEach(call);
32190
+ if (reading) return;
32191
+ destroys.forEach(call);
32192
+ callback(error);
32193
+ });
32194
+ });
32195
+ return streams.reduce(pipe);
32196
+ }
32197
+
32198
+ module.exports = pipeline;
32199
+
32200
+ /***/ }),
32201
+ /* 264 */
32202
+ /***/ (function(module, exports, __webpack_require__) {
32203
+
32204
+ /* WEBPACK VAR INJECTION */(function(global) {/*! queue-microtask. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
32205
+ let promise
32206
+
32207
+ module.exports = typeof queueMicrotask === 'function'
32208
+ ? queueMicrotask.bind(typeof window !== 'undefined' ? window : global)
32209
+ // reuse resolved promise, and allocate it lazily
32210
+ : cb => (promise || (promise = Promise.resolve()))
32211
+ .then(cb)
32212
+ .catch(err => setTimeout(() => { throw err }, 0))
32213
+
32214
+ /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(2)))
32215
+
32216
+ /***/ }),
32217
+ /* 265 */
32218
+ /***/ (function(module, exports, __webpack_require__) {
32219
+
32220
+ "use strict";
32221
+
32222
+
32223
+ /**
32224
+ * @typedef {{ [key: string]: any }} Extensions
32225
+ * @typedef {Error} Err
32226
+ * @property {string} message
32227
+ */
32228
+
32229
+ /**
32230
+ *
32231
+ * @param {Error} obj
32232
+ * @param {Extensions} props
32233
+ * @returns {Error & Extensions}
32234
+ */
32235
+ function assign(obj, props) {
32236
+ for (const key in props) {
32237
+ Object.defineProperty(obj, key, {
32238
+ value: props[key],
32239
+ enumerable: true,
32240
+ configurable: true,
32241
+ });
32242
+ }
32243
+
32244
+ return obj;
32245
+ }
32353
32246
 
32354
- var onerror = function onerror(err) {
32355
- callback.call(stream, err);
32356
- };
32247
+ /**
32248
+ *
32249
+ * @param {any} err - An Error
32250
+ * @param {string|Extensions} code - A string code or props to set on the error
32251
+ * @param {Extensions} [props] - Props to set on the error
32252
+ * @returns {Error & Extensions}
32253
+ */
32254
+ function createError(err, code, props) {
32255
+ if (!err || typeof err === 'string') {
32256
+ throw new TypeError('Please pass an Error to err-code');
32257
+ }
32357
32258
 
32358
- var onclose = function onclose() {
32359
- var err;
32259
+ if (!props) {
32260
+ props = {};
32261
+ }
32360
32262
 
32361
- if (readable && !readableEnded) {
32362
- if (!stream._readableState || !stream._readableState.ended) err = new ERR_STREAM_PREMATURE_CLOSE();
32363
- return callback.call(stream, err);
32263
+ if (typeof code === 'object') {
32264
+ props = code;
32265
+ code = '';
32364
32266
  }
32365
32267
 
32366
- if (writable && !writableEnded) {
32367
- if (!stream._writableState || !stream._writableState.ended) err = new ERR_STREAM_PREMATURE_CLOSE();
32368
- return callback.call(stream, err);
32268
+ if (code) {
32269
+ props.code = code;
32369
32270
  }
32370
- };
32371
32271
 
32372
- var onrequest = function onrequest() {
32373
- stream.req.on('finish', onfinish);
32374
- };
32272
+ try {
32273
+ return assign(err, props);
32274
+ } catch (_) {
32275
+ props.message = err.message;
32276
+ props.stack = err.stack;
32375
32277
 
32376
- if (isRequest(stream)) {
32377
- stream.on('complete', onfinish);
32378
- stream.on('abort', onclose);
32379
- if (stream.req) onrequest();else stream.on('request', onrequest);
32380
- } else if (writable && !stream._writableState) {
32381
- // legacy streams
32382
- stream.on('end', onlegacyfinish);
32383
- stream.on('close', onlegacyfinish);
32384
- }
32278
+ const ErrClass = function () {};
32385
32279
 
32386
- stream.on('end', onend);
32387
- stream.on('finish', onfinish);
32388
- if (opts.error !== false) stream.on('error', onerror);
32389
- stream.on('close', onclose);
32390
- return function () {
32391
- stream.removeListener('complete', onfinish);
32392
- stream.removeListener('abort', onclose);
32393
- stream.removeListener('request', onrequest);
32394
- if (stream.req) stream.req.removeListener('finish', onfinish);
32395
- stream.removeListener('end', onlegacyfinish);
32396
- stream.removeListener('close', onlegacyfinish);
32397
- stream.removeListener('finish', onfinish);
32398
- stream.removeListener('end', onend);
32399
- stream.removeListener('error', onerror);
32400
- stream.removeListener('close', onclose);
32401
- };
32402
- }
32280
+ ErrClass.prototype = Object.create(Object.getPrototypeOf(err));
32403
32281
 
32404
- module.exports = eos;
32282
+ // @ts-ignore
32283
+ const output = assign(new ErrClass(), props);
32405
32284
 
32406
- /***/ }),
32407
- /* 262 */
32408
- /***/ (function(module, exports) {
32285
+ return output;
32286
+ }
32287
+ }
32409
32288
 
32410
- module.exports = function () {
32411
- throw new Error('Readable.from is not available in the browser')
32412
- };
32289
+ module.exports = createError;
32413
32290
 
32414
32291
 
32415
32292
  /***/ }),
32416
- /* 263 */
32293
+ /* 266 */
32417
32294
  /***/ (function(module, exports, __webpack_require__) {
32418
32295
 
32419
32296
  "use strict";
32420
- // Copyright Joyent, Inc. and other Node contributors.
32421
- //
32422
- // Permission is hereby granted, free of charge, to any person obtaining a
32423
- // copy of this software and associated documentation files (the
32424
- // "Software"), to deal in the Software without restriction, including
32425
- // without limitation the rights to use, copy, modify, merge, publish,
32426
- // distribute, sublicense, and/or sell copies of the Software, and to permit
32427
- // persons to whom the Software is furnished to do so, subject to the
32428
- // following conditions:
32429
- //
32430
- // The above copyright notice and this permission notice shall be included
32431
- // in all copies or substantial portions of the Software.
32432
- //
32433
- // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
32434
- // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
32435
- // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
32436
- // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
32437
- // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
32438
- // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
32439
- // USE OR OTHER DEALINGS IN THE SOFTWARE.
32440
- // a transform stream is a readable/writable stream where you do
32441
- // something with the data. Sometimes it's called a "filter",
32442
- // but that's not a great name for it, since that implies a thing where
32443
- // some bits pass through, and others are simply ignored. (That would
32444
- // be a valid example of a transform, of course.)
32445
- //
32446
- // While the output is causally related to the input, it's not a
32447
- // necessarily symmetric or synchronous transformation. For example,
32448
- // a zlib stream might take multiple plain-text writes(), and then
32449
- // emit a single compressed chunk some time in the future.
32450
- //
32451
- // Here's how this works:
32452
- //
32453
- // The Transform stream has all the aspects of the readable and writable
32454
- // stream classes. When you write(chunk), that calls _write(chunk,cb)
32455
- // internally, and returns false if there's a lot of pending writes
32456
- // buffered up. When you call read(), that calls _read(n) until
32457
- // there's enough pending readable data buffered up.
32458
- //
32459
- // In a transform stream, the written data is placed in a buffer. When
32460
- // _read(n) is called, it transforms the queued up data, calling the
32461
- // buffered _write cb's as it consumes chunks. If consuming a single
32462
- // written chunk would result in multiple output chunks, then the first
32463
- // outputted bit calls the readcb, and subsequent chunks just go into
32464
- // the read buffer, and will cause it to emit 'readable' if necessary.
32465
- //
32466
- // This way, back-pressure is actually determined by the reading side,
32467
- // since _read has to be called to start processing a new chunk. However,
32468
- // a pathological inflate type of transform can cause excessive buffering
32469
- // here. For example, imagine a stream where every byte of input is
32470
- // interpreted as an integer from 0-255, and then results in that many
32471
- // bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in
32472
- // 1kb of data being output. In this case, you could write a very small
32473
- // amount of input, and end up with a very large amount of output. In
32474
- // such a pathological inflating mechanism, there'd be no way to tell
32475
- // the system to stop doing the transform. A single 4MB write could
32476
- // cause the system to run out of memory.
32477
- //
32478
- // However, even in such a pathological case, only a single written chunk
32479
- // would be consumed, and then the rest would wait (un-transformed) until
32480
- // the results of the previous transformed chunk were consumed.
32481
-
32482
-
32483
- module.exports = Transform;
32484
-
32485
- var _require$codes = __webpack_require__(254).codes,
32486
- ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED,
32487
- ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK,
32488
- ERR_TRANSFORM_ALREADY_TRANSFORMING = _require$codes.ERR_TRANSFORM_ALREADY_TRANSFORMING,
32489
- ERR_TRANSFORM_WITH_LENGTH_0 = _require$codes.ERR_TRANSFORM_WITH_LENGTH_0;
32490
32297
 
32491
- var Duplex = __webpack_require__(256);
32492
-
32493
- __webpack_require__(255)(Transform, Duplex);
32298
+ Object.defineProperty(exports, "__esModule", { value: true });
32299
+ exports.DigitalHumanVideoPlayManager = void 0;
32300
+ const MessageTypes_1 = __webpack_require__(267);
32301
+ const logger_1 = __webpack_require__(233);
32302
+ class DigitalHumanVideoPlayManager {
32303
+ constructor(messages) {
32304
+ this.messages = messages;
32305
+ // Used to track the number of attempts to re-play the DH video (Safari 15+ stream not visible)
32306
+ this.remoteVideoPlayCount = 0;
32307
+ }
32308
+ play(video) {
32309
+ this.video = video;
32310
+ this.playRemoteVideo();
32311
+ }
32312
+ unmuteVideo() {
32313
+ if (this.video && this.video.muted) {
32314
+ this.video.muted = false;
32315
+ this.messages.next(new MessageTypes_1.DigitalHumanUnmuted());
32316
+ }
32317
+ }
32318
+ playRemoteVideo() {
32319
+ // Play the digital human video when session is live (i.e. video and audio streaming in both directions)
32320
+ if (this.video) {
32321
+ /*
32322
+ Note: do not set autplay = true, or safari will handle the play() differently to Chrome
32323
+ 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
32325
+ is that the DigitalHumanPlayedInMutedModeSuccess is not sent. tldr; do not set autoplay = true
32326
+ */
32327
+ // Catch general video errors and video unmute errors
32328
+ this.video.onerror = (error) => {
32329
+ this.messages.next(new MessageTypes_1.DigitalHumanVideoError(error));
32330
+ };
32331
+ this.video.play().catch(() => {
32332
+ // video failed to play, mute video then see if it will play
32333
+ this.messages.next(new MessageTypes_1.DigitalHumanFailedToPlay());
32334
+ this.video.muted = true;
32335
+ this.video.play()
32336
+ .then(() => {
32337
+ logger_1.logger.log('Muting the digital human and playing it succeeded.');
32338
+ // video did play once it was muted.
32339
+ this.messages.next(new MessageTypes_1.DigitalHumanPlayedInMutedModeSuccess());
32340
+ this.video.addEventListener('click', () => { this.unmuteVideo(); }, { once: true });
32341
+ })
32342
+ .catch((err) => {
32343
+ logger_1.logger.log('Could not play digital human video even as muted, starting exponential backoff.', err);
32344
+ // video still could not play even when muted, let's try an exponential back off
32345
+ this.playRemoteVideoWithExponentialBackoff();
32346
+ });
32347
+ });
32348
+ }
32349
+ }
32350
+ playRemoteVideoWithExponentialBackoff() {
32351
+ // Play the digital human video when session is live (i.e. video and audio streaming in both directions)
32352
+ if (this.video) {
32353
+ this.video.autoplay = true;
32354
+ this.video.play();
32355
+ // Re-call play() on the DH video after some time out (exponential backoff) up to 10 times.
32356
+ // This is to work around a bug in Safari 15 that prevents the video stream from being visible some times.
32357
+ this.remoteVideoPlayCount++;
32358
+ setTimeout(() => {
32359
+ if (this.remoteVideoPlayCount < 10) {
32360
+ this.playRemoteVideoWithExponentialBackoff();
32361
+ }
32362
+ }, 100 * (this.remoteVideoPlayCount - 1));
32363
+ }
32364
+ }
32365
+ }
32366
+ exports.DigitalHumanVideoPlayManager = DigitalHumanVideoPlayManager;
32494
32367
 
32495
- function afterTransform(er, data) {
32496
- var ts = this._transformState;
32497
- ts.transforming = false;
32498
- var cb = ts.writecb;
32499
32368
 
32500
- if (cb === null) {
32501
- return this.emit('error', new ERR_MULTIPLE_CALLBACK());
32502
- }
32369
+ /***/ }),
32370
+ /* 267 */
32371
+ /***/ (function(module, exports, __webpack_require__) {
32503
32372
 
32504
- ts.writechunk = null;
32505
- ts.writecb = null;
32506
- if (data != null) // single equals check for both `null` and `undefined`
32507
- this.push(data);
32508
- cb(er);
32509
- var rs = this._readableState;
32510
- rs.reading = false;
32373
+ "use strict";
32511
32374
 
32512
- if (rs.needReadable || rs.length < rs.highWaterMark) {
32513
- this._read(rs.highWaterMark);
32514
- }
32375
+ Object.defineProperty(exports, "__esModule", { value: true });
32376
+ exports.DigitalHumanUnmuted = exports.DigitalHumanPlayedInMutedModeSuccess = exports.DigitalHumanFailedToPlay = exports.DigitalHumanVideoError = exports.ClientPerformanceMessage = exports.ClientMediaStreamUpdateMessage = exports.OnlineStatusUpdateMessage = exports.SessionInfoMessage = exports.AvatarRequestIgnored = exports.AvatarRequestCompleted = exports.SessionErrorMessage = exports.WebRtcStatsMessage = exports.WebRtcDataMessage = exports.SessionLiveMessage = exports.WarningMessage = exports.RecordingStoppedMessage = exports.RecordingStartedMessage = exports.DevicePermissionAllowedMessage = exports.AvatarTextInputFinishedMessage = exports.FinishedSpeakingMessage = exports.StartedSpeakingMessage = exports.AvatarQuestionMessage = exports.InstructionsMessage = exports.AvatarAnswerContentMessage = exports.AvatarAnswerMessage = exports.ConnectionLostMessage = exports.VoiceActivityInputModeNotSupportedMessage = exports.MicActivityNotSupportedMessage = exports.MicActivityMessage = exports.MicActivityErrorMessage = exports.ServiceUnavailableMessage = exports.AvatarUnavailableMessage = exports.AvatarAvailableMessage = exports.SessionEndedMessage = exports.SessionResumedMessage = exports.SessionPausedMessage = exports.DeviceListUpdatedMessage = exports.DeviceErrorMessage = exports.SetSpeakerSuccessMessage = exports.SetMicSuccessMessage = exports.SetCameraSuccessMessage = exports.DeviceNotFoundErrorMessage = exports.ReadyMessage = exports.UneeqMessageType = void 0;
32377
+ var UneeqMessageType;
32378
+ (function (UneeqMessageType) {
32379
+ UneeqMessageType["Ready"] = "Ready";
32380
+ UneeqMessageType["DeviceNotFoundError"] = "DeviceNotFoundError";
32381
+ UneeqMessageType["SetCameraSuccess"] = "SetCameraSuccess";
32382
+ UneeqMessageType["SetMicSuccess"] = "SetMicSuccess";
32383
+ UneeqMessageType["SetSpeakerSuccess"] = "SetSpeakerSuccess";
32384
+ UneeqMessageType["SessionPaused"] = "SessionPaused";
32385
+ UneeqMessageType["SessionResumed"] = "SessionResumed";
32386
+ UneeqMessageType["SessionEnded"] = "SessionEnded";
32387
+ UneeqMessageType["AvatarAvailable"] = "AvatarAvailable";
32388
+ UneeqMessageType["AvatarUnavailable"] = "AvatarUnavailable";
32389
+ UneeqMessageType["ConnectionLost"] = "ConnectionLost";
32390
+ UneeqMessageType["ServiceUnavailable"] = "ServiceUnavailable";
32391
+ UneeqMessageType["OnlineStatusUpdate"] = "OnlineStatusUpdate";
32392
+ UneeqMessageType["MicActivityNotSupported"] = "MicActivityNotSupported";
32393
+ UneeqMessageType["VoiceActivityInputModeNotSupported"] = "VoiceActivityInputModeNotSupported";
32394
+ UneeqMessageType["MicActivityError"] = "MicActivityError";
32395
+ UneeqMessageType["MicActivity"] = "MicActivity";
32396
+ UneeqMessageType["DeviceError"] = "DeviceError";
32397
+ UneeqMessageType["DeviceListUpdated"] = "DeviceListUpdated";
32398
+ UneeqMessageType["AvatarAnswer"] = "AvatarAnswer";
32399
+ UneeqMessageType["AvatarAnswerContent"] = "AvatarAnswerContent";
32400
+ UneeqMessageType["Instructions"] = "Instructions";
32401
+ UneeqMessageType["StartedSpeaking"] = "StartedSpeaking";
32402
+ UneeqMessageType["FinishedSpeaking"] = "FinishedSpeaking";
32403
+ UneeqMessageType["AvatarTextInputFinished"] = "AvatarTextInputFinished";
32404
+ UneeqMessageType["AvatarQuestionText"] = "AvatarQuestionText";
32405
+ UneeqMessageType["DevicePermissionAllowed"] = "DevicePermissionAllowed";
32406
+ UneeqMessageType["RecordingStarted"] = "RecordingStarted";
32407
+ UneeqMessageType["RecordingStopped"] = "RecordingStopped";
32408
+ UneeqMessageType["Warning"] = "Warning";
32409
+ UneeqMessageType["SessionLive"] = "SessionLive";
32410
+ UneeqMessageType["WebRtcData"] = "WebRtcData";
32411
+ UneeqMessageType["WebRtcStats"] = "WebRtcStats";
32412
+ UneeqMessageType["SessionError"] = "SessionError";
32413
+ UneeqMessageType["SessionInfo"] = "SessionInfo";
32414
+ UneeqMessageType["AvatarRequestCompleted"] = "AvatarRequestCompleted";
32415
+ UneeqMessageType["AvatarRequestIgnored"] = "AvatarRequestIgnored";
32416
+ UneeqMessageType["ClientMediaStreamUpdate"] = "ClientMediaStreamUpdate";
32417
+ UneeqMessageType["ClientPerformanceMessage"] = "ClientPerformanceMessage";
32418
+ UneeqMessageType["DigitalHumanVideoError"] = "DigitalHumanVideoError";
32419
+ UneeqMessageType["DigitalHumanFailedToPlay"] = "DigitalHumanFailedToPlay";
32420
+ UneeqMessageType["DigitalHumanPlayedInMutedModeSuccess"] = "DigitalHumanPlayedInMutedModeSuccess";
32421
+ UneeqMessageType["DigitalHumanUnmuted"] = "DigitalHumanUnmuted";
32422
+ })(UneeqMessageType = exports.UneeqMessageType || (exports.UneeqMessageType = {}));
32423
+ /**
32424
+ * Service is ready to be used
32425
+ */
32426
+ class ReadyMessage {
32427
+ constructor() {
32428
+ this.uneeqMessageType = UneeqMessageType.Ready;
32429
+ }
32430
+ }
32431
+ exports.ReadyMessage = ReadyMessage;
32432
+ /**
32433
+ * Selected device is not found
32434
+ */
32435
+ class DeviceNotFoundErrorMessage {
32436
+ constructor(msg, deviceId) {
32437
+ this.msg = msg;
32438
+ this.deviceId = deviceId;
32439
+ this.uneeqMessageType = UneeqMessageType.DeviceNotFoundError;
32440
+ }
32441
+ }
32442
+ exports.DeviceNotFoundErrorMessage = DeviceNotFoundErrorMessage;
32443
+ /**
32444
+ * Users camera has been set successfully
32445
+ */
32446
+ class SetCameraSuccessMessage {
32447
+ constructor(deviceId) {
32448
+ this.deviceId = deviceId;
32449
+ this.uneeqMessageType = UneeqMessageType.SetCameraSuccess;
32450
+ }
32451
+ }
32452
+ exports.SetCameraSuccessMessage = SetCameraSuccessMessage;
32453
+ /**
32454
+ * Users microphone has been set successfully
32455
+ */
32456
+ class SetMicSuccessMessage {
32457
+ constructor(deviceId) {
32458
+ this.deviceId = deviceId;
32459
+ this.uneeqMessageType = UneeqMessageType.SetMicSuccess;
32460
+ }
32461
+ }
32462
+ exports.SetMicSuccessMessage = SetMicSuccessMessage;
32463
+ /**
32464
+ * Users speaker has been set successfully
32465
+ */
32466
+ class SetSpeakerSuccessMessage {
32467
+ constructor(deviceId) {
32468
+ this.deviceId = deviceId;
32469
+ this.uneeqMessageType = UneeqMessageType.SetSpeakerSuccess;
32470
+ }
32471
+ }
32472
+ exports.SetSpeakerSuccessMessage = SetSpeakerSuccessMessage;
32473
+ /**
32474
+ * An error has occured with the users device
32475
+ */
32476
+ class DeviceErrorMessage {
32477
+ constructor(error) {
32478
+ this.error = error;
32479
+ this.uneeqMessageType = UneeqMessageType.DeviceError;
32480
+ }
32481
+ }
32482
+ exports.DeviceErrorMessage = DeviceErrorMessage;
32483
+ /**
32484
+ * The device list has been changed or retrieved for the first time
32485
+ */
32486
+ class DeviceListUpdatedMessage {
32487
+ constructor(devices) {
32488
+ this.devices = devices;
32489
+ this.uneeqMessageType = UneeqMessageType.DeviceListUpdated;
32490
+ }
32491
+ }
32492
+ exports.DeviceListUpdatedMessage = DeviceListUpdatedMessage;
32493
+ /**
32494
+ * Session has been paused successfully
32495
+ */
32496
+ class SessionPausedMessage {
32497
+ constructor() {
32498
+ this.uneeqMessageType = UneeqMessageType.SessionPaused;
32499
+ }
32500
+ }
32501
+ exports.SessionPausedMessage = SessionPausedMessage;
32502
+ /**
32503
+ * Session has been resumed successfully
32504
+ */
32505
+ class SessionResumedMessage {
32506
+ constructor() {
32507
+ this.uneeqMessageType = UneeqMessageType.SessionResumed;
32508
+ }
32509
+ }
32510
+ exports.SessionResumedMessage = SessionResumedMessage;
32511
+ /**
32512
+ * Session has been ended successfully
32513
+ */
32514
+ class SessionEndedMessage {
32515
+ constructor() {
32516
+ this.uneeqMessageType = UneeqMessageType.SessionEnded;
32517
+ }
32518
+ }
32519
+ exports.SessionEndedMessage = SessionEndedMessage;
32520
+ /**
32521
+ * An avatar is available
32522
+ */
32523
+ class AvatarAvailableMessage {
32524
+ constructor() {
32525
+ this.uneeqMessageType = UneeqMessageType.AvatarAvailable;
32526
+ }
32527
+ }
32528
+ exports.AvatarAvailableMessage = AvatarAvailableMessage;
32529
+ /**
32530
+ * There are no avatars currently available
32531
+ */
32532
+ class AvatarUnavailableMessage {
32533
+ constructor() {
32534
+ this.uneeqMessageType = UneeqMessageType.AvatarUnavailable;
32535
+ }
32536
+ }
32537
+ exports.AvatarUnavailableMessage = AvatarUnavailableMessage;
32538
+ /**
32539
+ * Service is unavailable
32540
+ */
32541
+ class ServiceUnavailableMessage {
32542
+ constructor(error) {
32543
+ this.error = error;
32544
+ this.uneeqMessageType = UneeqMessageType.ServiceUnavailable;
32545
+ }
32546
+ }
32547
+ exports.ServiceUnavailableMessage = ServiceUnavailableMessage;
32548
+ /**
32549
+ * An error occured with mic activity messages
32550
+ */
32551
+ class MicActivityErrorMessage {
32552
+ constructor(error) {
32553
+ this.error = error;
32554
+ this.uneeqMessageType = UneeqMessageType.MicActivityError;
32555
+ }
32556
+ }
32557
+ exports.MicActivityErrorMessage = MicActivityErrorMessage;
32558
+ /**
32559
+ * Message is sent upon activity of the user microphone
32560
+ *
32561
+ * Visibility is controlled by UneeqOptions param micActivityMessages
32562
+ */
32563
+ class MicActivityMessage {
32564
+ constructor(level) {
32565
+ this.level = level;
32566
+ this.uneeqMessageType = UneeqMessageType.MicActivity;
32567
+ }
32568
+ }
32569
+ exports.MicActivityMessage = MicActivityMessage;
32570
+ /**
32571
+ * Mic activity messages are not supported by the users browser
32572
+ *
32573
+ * Visibility is controlled by UneeqOptions param micActivityMessages
32574
+ */
32575
+ class MicActivityNotSupportedMessage {
32576
+ constructor() {
32577
+ this.uneeqMessageType = UneeqMessageType.MicActivityNotSupported;
32578
+ }
32579
+ }
32580
+ exports.MicActivityNotSupportedMessage = MicActivityNotSupportedMessage;
32581
+ /**
32582
+ * Mic activity input mode is not supported by the users browser
32583
+ */
32584
+ class VoiceActivityInputModeNotSupportedMessage {
32585
+ constructor() {
32586
+ this.uneeqMessageType = UneeqMessageType.VoiceActivityInputModeNotSupported;
32587
+ }
32588
+ }
32589
+ exports.VoiceActivityInputModeNotSupportedMessage = VoiceActivityInputModeNotSupportedMessage;
32590
+ /**
32591
+ * Connection Lost
32592
+ */
32593
+ class ConnectionLostMessage {
32594
+ constructor(connectionState) {
32595
+ this.connectionState = connectionState;
32596
+ this.uneeqMessageType = UneeqMessageType.ConnectionLost;
32597
+ }
32598
+ }
32599
+ exports.ConnectionLostMessage = ConnectionLostMessage;
32600
+ /**
32601
+ * The avatar's answer to a question
32602
+ */
32603
+ class AvatarAnswerMessage {
32604
+ constructor(answer, answerAvatar, answerSpeech, transcriptId) {
32605
+ this.answer = answer;
32606
+ this.answerAvatar = answerAvatar;
32607
+ this.answerSpeech = answerSpeech;
32608
+ this.transcriptId = transcriptId;
32609
+ this.uneeqMessageType = UneeqMessageType.AvatarAnswer;
32610
+ }
32611
+ }
32612
+ exports.AvatarAnswerMessage = AvatarAnswerMessage;
32613
+ /**
32614
+ * The avatar's answer to a question (HTML Content)
32615
+ */
32616
+ class AvatarAnswerContentMessage {
32617
+ /**
32618
+ * @param content Note: If `hasDisplayHtml` = true, this content will contain the HTML provided by the displayHTML instruction.
32619
+ * If `hasDisplayHtml` = false, this content will contain the `answer` value
32620
+ * @param transcriptId
32621
+ * @param hasDisplayHtml
32622
+ */
32623
+ constructor(content, transcriptId, hasDisplayHtml = false) {
32624
+ this.content = content;
32625
+ this.transcriptId = transcriptId;
32626
+ this.hasDisplayHtml = hasDisplayHtml;
32627
+ this.uneeqMessageType = UneeqMessageType.AvatarAnswerContent;
32628
+ }
32629
+ }
32630
+ exports.AvatarAnswerContentMessage = AvatarAnswerContentMessage;
32631
+ class InstructionsMessage {
32632
+ /**
32633
+ *
32634
+ * @param instructions is an object defined on the NLP which is passed to the client in response to certain questions
32635
+ */
32636
+ constructor(instructions) {
32637
+ this.instructions = instructions;
32638
+ this.uneeqMessageType = UneeqMessageType.Instructions;
32639
+ }
32515
32640
  }
32516
-
32517
- function Transform(options) {
32518
- if (!(this instanceof Transform)) return new Transform(options);
32519
- Duplex.call(this, options);
32520
- this._transformState = {
32521
- afterTransform: afterTransform.bind(this),
32522
- needTransform: false,
32523
- transforming: false,
32524
- writecb: null,
32525
- writechunk: null,
32526
- writeencoding: null
32527
- }; // start out asking for a readable event once data is transformed.
32528
-
32529
- this._readableState.needReadable = true; // we have implemented the _read method, and done the other things
32530
- // that Readable wants before the first _read call, so unset the
32531
- // sync guard flag.
32532
-
32533
- this._readableState.sync = false;
32534
-
32535
- if (options) {
32536
- if (typeof options.transform === 'function') this._transform = options.transform;
32537
- if (typeof options.flush === 'function') this._flush = options.flush;
32538
- } // When the writable side finishes, then flush out anything remaining.
32539
-
32540
-
32541
- this.on('prefinish', prefinish);
32641
+ exports.InstructionsMessage = InstructionsMessage;
32642
+ /**
32643
+ * The question the user asked
32644
+ */
32645
+ class AvatarQuestionMessage {
32646
+ constructor(question, transcriptId) {
32647
+ this.question = question;
32648
+ this.transcriptId = transcriptId;
32649
+ this.uneeqMessageType = UneeqMessageType.AvatarQuestionText;
32650
+ }
32542
32651
  }
32543
-
32544
- function prefinish() {
32545
- var _this = this;
32546
-
32547
- if (typeof this._flush === 'function' && !this._readableState.destroyed) {
32548
- this._flush(function (er, data) {
32549
- done(_this, er, data);
32550
- });
32551
- } else {
32552
- done(this, null, null);
32553
- }
32652
+ exports.AvatarQuestionMessage = AvatarQuestionMessage;
32653
+ /**
32654
+ * Digital human has started speaking the message
32655
+ */
32656
+ class StartedSpeakingMessage {
32657
+ constructor() {
32658
+ this.uneeqMessageType = UneeqMessageType.StartedSpeaking;
32659
+ }
32554
32660
  }
32555
-
32556
- Transform.prototype.push = function (chunk, encoding) {
32557
- this._transformState.needTransform = false;
32558
- return Duplex.prototype.push.call(this, chunk, encoding);
32559
- }; // This is the part where you do stuff!
32560
- // override this function in implementation classes.
32561
- // 'chunk' is an input chunk.
32562
- //
32563
- // Call `push(newChunk)` to pass along transformed output
32564
- // to the readable side. You may call 'push' zero or more times.
32565
- //
32566
- // Call `cb(err)` when you are done with this chunk. If you pass
32567
- // an error, then that'll put the hurt on the whole operation. If you
32568
- // never call cb(), then you'll never get another chunk.
32569
-
32570
-
32571
- Transform.prototype._transform = function (chunk, encoding, cb) {
32572
- cb(new ERR_METHOD_NOT_IMPLEMENTED('_transform()'));
32573
- };
32574
-
32575
- Transform.prototype._write = function (chunk, encoding, cb) {
32576
- var ts = this._transformState;
32577
- ts.writecb = cb;
32578
- ts.writechunk = chunk;
32579
- ts.writeencoding = encoding;
32580
-
32581
- if (!ts.transforming) {
32582
- var rs = this._readableState;
32583
- if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark);
32584
- }
32585
- }; // Doesn't matter what the args are here.
32586
- // _transform does all the work.
32587
- // That we got here means that the readable side wants more data.
32588
-
32589
-
32590
- Transform.prototype._read = function (n) {
32591
- var ts = this._transformState;
32592
-
32593
- if (ts.writechunk !== null && !ts.transforming) {
32594
- ts.transforming = true;
32595
-
32596
- this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);
32597
- } else {
32598
- // mark that we need a transform, so that any data that comes in
32599
- // will get processed, now that we've asked for it.
32600
- ts.needTransform = true;
32601
- }
32602
- };
32603
-
32604
- Transform.prototype._destroy = function (err, cb) {
32605
- Duplex.prototype._destroy.call(this, err, function (err2) {
32606
- cb(err2);
32607
- });
32608
- };
32609
-
32610
- function done(stream, er, data) {
32611
- if (er) return stream.emit('error', er);
32612
- if (data != null) // single equals check for both `null` and `undefined`
32613
- stream.push(data); // TODO(BridgeAR): Write a test for these two error cases
32614
- // if there's nothing in the write buffer, then that means
32615
- // that nothing more will ever be provided
32616
-
32617
- if (stream._writableState.length) throw new ERR_TRANSFORM_WITH_LENGTH_0();
32618
- if (stream._transformState.transforming) throw new ERR_TRANSFORM_ALREADY_TRANSFORMING();
32619
- return stream.push(null);
32661
+ exports.StartedSpeakingMessage = StartedSpeakingMessage;
32662
+ /**
32663
+ * Digital human has finished speaking the message
32664
+ */
32665
+ class FinishedSpeakingMessage {
32666
+ constructor() {
32667
+ this.uneeqMessageType = UneeqMessageType.FinishedSpeaking;
32668
+ }
32620
32669
  }
32621
-
32622
- /***/ }),
32623
- /* 264 */
32624
- /***/ (function(module, exports, __webpack_require__) {
32625
-
32626
- "use strict";
32627
- // Copyright Joyent, Inc. and other Node contributors.
32628
- //
32629
- // Permission is hereby granted, free of charge, to any person obtaining a
32630
- // copy of this software and associated documentation files (the
32631
- // "Software"), to deal in the Software without restriction, including
32632
- // without limitation the rights to use, copy, modify, merge, publish,
32633
- // distribute, sublicense, and/or sell copies of the Software, and to permit
32634
- // persons to whom the Software is furnished to do so, subject to the
32635
- // following conditions:
32636
- //
32637
- // The above copyright notice and this permission notice shall be included
32638
- // in all copies or substantial portions of the Software.
32639
- //
32640
- // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
32641
- // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
32642
- // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
32643
- // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
32644
- // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
32645
- // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
32646
- // USE OR OTHER DEALINGS IN THE SOFTWARE.
32647
- // a passthrough stream.
32648
- // basically just the most minimal sort of Transform stream.
32649
- // Every written chunk gets output as-is.
32650
-
32651
-
32652
- module.exports = PassThrough;
32653
-
32654
- var Transform = __webpack_require__(263);
32655
-
32656
- __webpack_require__(255)(PassThrough, Transform);
32657
-
32658
- function PassThrough(options) {
32659
- if (!(this instanceof PassThrough)) return new PassThrough(options);
32660
- Transform.call(this, options);
32670
+ exports.FinishedSpeakingMessage = FinishedSpeakingMessage;
32671
+ /**
32672
+ * [Deprecated] Avatar has finished speaking the message. Deprecated, use FinishedSpeakingMessage
32673
+ */
32674
+ class AvatarTextInputFinishedMessage {
32675
+ constructor() {
32676
+ this.uneeqMessageType = UneeqMessageType.AvatarTextInputFinished;
32677
+ }
32661
32678
  }
32662
-
32663
- PassThrough.prototype._transform = function (chunk, encoding, cb) {
32664
- cb(null, chunk);
32665
- };
32666
-
32667
- /***/ }),
32668
- /* 265 */
32669
- /***/ (function(module, exports, __webpack_require__) {
32670
-
32671
- "use strict";
32672
- // Ported from https://github.com/mafintosh/pump with
32673
- // permission from the author, Mathias Buus (@mafintosh).
32674
-
32675
-
32676
- var eos;
32677
-
32678
- function once(callback) {
32679
- var called = false;
32680
- return function () {
32681
- if (called) return;
32682
- called = true;
32683
- callback.apply(void 0, arguments);
32684
- };
32679
+ exports.AvatarTextInputFinishedMessage = AvatarTextInputFinishedMessage;
32680
+ /**
32681
+ * User has given permission to use devices
32682
+ */
32683
+ class DevicePermissionAllowedMessage {
32684
+ constructor() {
32685
+ this.uneeqMessageType = UneeqMessageType.DevicePermissionAllowed;
32686
+ }
32685
32687
  }
32686
-
32687
- var _require$codes = __webpack_require__(254).codes,
32688
- ERR_MISSING_ARGS = _require$codes.ERR_MISSING_ARGS,
32689
- ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED;
32690
-
32691
- function noop(err) {
32692
- // Rethrow the error if it exists to avoid swallowing it
32693
- if (err) throw err;
32688
+ exports.DevicePermissionAllowedMessage = DevicePermissionAllowedMessage;
32689
+ /**
32690
+ * User has started a recording successfully
32691
+ */
32692
+ class RecordingStartedMessage {
32693
+ constructor() {
32694
+ this.uneeqMessageType = UneeqMessageType.RecordingStarted;
32695
+ }
32694
32696
  }
32695
-
32696
- function isRequest(stream) {
32697
- return stream.setHeader && typeof stream.abort === 'function';
32697
+ exports.RecordingStartedMessage = RecordingStartedMessage;
32698
+ /**
32699
+ * User has stopped recording successfully
32700
+ */
32701
+ class RecordingStoppedMessage {
32702
+ constructor() {
32703
+ this.uneeqMessageType = UneeqMessageType.RecordingStopped;
32704
+ }
32698
32705
  }
32699
-
32700
- function destroyer(stream, reading, writing, callback) {
32701
- callback = once(callback);
32702
- var closed = false;
32703
- stream.on('close', function () {
32704
- closed = true;
32705
- });
32706
- if (eos === undefined) eos = __webpack_require__(261);
32707
- eos(stream, {
32708
- readable: reading,
32709
- writable: writing
32710
- }, function (err) {
32711
- if (err) return callback(err);
32712
- closed = true;
32713
- callback();
32714
- });
32715
- var destroyed = false;
32716
- return function (err) {
32717
- if (closed) return;
32718
- if (destroyed) return;
32719
- destroyed = true; // request.destroy just do .end - .abort is what we want
32720
-
32721
- if (isRequest(stream)) return stream.abort();
32722
- if (typeof stream.destroy === 'function') return stream.destroy();
32723
- callback(err || new ERR_STREAM_DESTROYED('pipe'));
32724
- };
32706
+ exports.RecordingStoppedMessage = RecordingStoppedMessage;
32707
+ /**
32708
+ * General Warning Message - refer to msg
32709
+ */
32710
+ class WarningMessage {
32711
+ constructor(msg) {
32712
+ this.msg = msg;
32713
+ this.uneeqMessageType = UneeqMessageType.Warning;
32714
+ }
32725
32715
  }
32726
-
32727
- function call(fn) {
32728
- fn();
32716
+ exports.WarningMessage = WarningMessage;
32717
+ /**
32718
+ * Session is Live, avatar video is active
32719
+ */
32720
+ class SessionLiveMessage {
32721
+ constructor(showLogo) {
32722
+ this.showLogo = showLogo;
32723
+ this.uneeqMessageType = UneeqMessageType.SessionLive;
32724
+ }
32729
32725
  }
32730
-
32731
- function pipe(from, to) {
32732
- return from.pipe(to);
32726
+ exports.SessionLiveMessage = SessionLiveMessage;
32727
+ /**
32728
+ * WebRTC data channel message
32729
+ */
32730
+ class WebRtcDataMessage {
32731
+ constructor(data) {
32732
+ this.data = data;
32733
+ this.uneeqMessageType = UneeqMessageType.WebRtcData;
32734
+ }
32733
32735
  }
32734
-
32735
- function popCallback(streams) {
32736
- if (!streams.length) return noop;
32737
- if (typeof streams[streams.length - 1] !== 'function') return noop;
32738
- return streams.pop();
32736
+ exports.WebRtcDataMessage = WebRtcDataMessage;
32737
+ /**
32738
+ * WebRTC stats message (diagnostics)
32739
+ */
32740
+ class WebRtcStatsMessage {
32741
+ constructor(stats) {
32742
+ this.stats = stats;
32743
+ this.uneeqMessageType = UneeqMessageType.WebRtcStats;
32744
+ }
32739
32745
  }
32740
-
32741
- function pipeline() {
32742
- for (var _len = arguments.length, streams = new Array(_len), _key = 0; _key < _len; _key++) {
32743
- streams[_key] = arguments[_key];
32744
- }
32745
-
32746
- var callback = popCallback(streams);
32747
- if (Array.isArray(streams[0])) streams = streams[0];
32748
-
32749
- if (streams.length < 2) {
32750
- throw new ERR_MISSING_ARGS('streams');
32751
- }
32752
-
32753
- var error;
32754
- var destroys = streams.map(function (stream, i) {
32755
- var reading = i < streams.length - 1;
32756
- var writing = i > 0;
32757
- return destroyer(stream, reading, writing, function (err) {
32758
- if (!error) error = err;
32759
- if (err) destroys.forEach(call);
32760
- if (reading) return;
32761
- destroys.forEach(call);
32762
- callback(error);
32763
- });
32764
- });
32765
- return streams.reduce(pipe);
32746
+ exports.WebRtcStatsMessage = WebRtcStatsMessage;
32747
+ /**
32748
+ * Session Error has occurred
32749
+ */
32750
+ class SessionErrorMessage {
32751
+ constructor(error) {
32752
+ this.error = error;
32753
+ this.uneeqMessageType = UneeqMessageType.SessionError;
32754
+ }
32766
32755
  }
32767
-
32768
- module.exports = pipeline;
32769
-
32770
- /***/ }),
32771
- /* 266 */
32772
- /***/ (function(module, exports, __webpack_require__) {
32773
-
32774
- /* WEBPACK VAR INJECTION */(function(global) {/*! queue-microtask. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
32775
- let promise
32776
-
32777
- module.exports = typeof queueMicrotask === 'function'
32778
- ? queueMicrotask.bind(typeof window !== 'undefined' ? window : global)
32779
- // reuse resolved promise, and allocate it lazily
32780
- : cb => (promise || (promise = Promise.resolve()))
32781
- .then(cb)
32782
- .catch(err => setTimeout(() => { throw err }, 0))
32783
-
32784
- /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(2)))
32785
-
32786
- /***/ }),
32787
- /* 267 */
32788
- /***/ (function(module, exports, __webpack_require__) {
32789
-
32790
- "use strict";
32791
-
32792
-
32756
+ exports.SessionErrorMessage = SessionErrorMessage;
32793
32757
  /**
32794
- * @typedef {{ [key: string]: any }} Extensions
32795
- * @typedef {Error} Err
32796
- * @property {string} message
32758
+ * Avatar request completed: the Avatar has completed processing a text or instruction request
32797
32759
  */
32798
-
32760
+ class AvatarRequestCompleted {
32761
+ constructor(reason) {
32762
+ this.reason = reason;
32763
+ this.uneeqMessageType = UneeqMessageType.AvatarRequestCompleted;
32764
+ }
32765
+ }
32766
+ exports.AvatarRequestCompleted = AvatarRequestCompleted;
32799
32767
  /**
32800
- *
32801
- * @param {Error} obj
32802
- * @param {Extensions} props
32803
- * @returns {Error & Extensions}
32768
+ * Avatar request ignored: the Avatar has ignored a request to speak
32804
32769
  */
32805
- function assign(obj, props) {
32806
- for (const key in props) {
32807
- Object.defineProperty(obj, key, {
32808
- value: props[key],
32809
- enumerable: true,
32810
- configurable: true,
32811
- });
32770
+ class AvatarRequestIgnored {
32771
+ constructor(reason) {
32772
+ this.reason = reason;
32773
+ this.uneeqMessageType = UneeqMessageType.AvatarRequestIgnored;
32812
32774
  }
32813
-
32814
- return obj;
32815
32775
  }
32816
-
32776
+ exports.AvatarRequestIgnored = AvatarRequestIgnored;
32817
32777
  /**
32818
- *
32819
- * @param {any} err - An Error
32820
- * @param {string|Extensions} code - A string code or props to set on the error
32821
- * @param {Extensions} [props] - Props to set on the error
32822
- * @returns {Error & Extensions}
32778
+ * Session Info Messages: Primarily used for testing, e.g. the active behaviour tag
32823
32779
  */
32824
- function createError(err, code, props) {
32825
- if (!err || typeof err === 'string') {
32826
- throw new TypeError('Please pass an Error to err-code');
32780
+ class SessionInfoMessage {
32781
+ constructor(info) {
32782
+ this.info = info;
32783
+ this.uneeqMessageType = UneeqMessageType.SessionInfo;
32827
32784
  }
32828
-
32829
- if (!props) {
32830
- props = {};
32785
+ }
32786
+ exports.SessionInfoMessage = SessionInfoMessage;
32787
+ /**
32788
+ * Clients network status has changed. {online: true|false}
32789
+ */
32790
+ class OnlineStatusUpdateMessage {
32791
+ constructor(online) {
32792
+ this.online = online;
32793
+ this.uneeqMessageType = UneeqMessageType.OnlineStatusUpdate;
32831
32794
  }
32832
-
32833
- if (typeof code === 'object') {
32834
- props = code;
32835
- code = '';
32795
+ }
32796
+ exports.OnlineStatusUpdateMessage = OnlineStatusUpdateMessage;
32797
+ class ClientMediaStreamUpdateMessage {
32798
+ constructor(clientStreamingAudio, clientStreamingVideo, serverStreamingAudio, serverStreamingVideo) {
32799
+ this.clientStreamingAudio = clientStreamingAudio;
32800
+ this.clientStreamingVideo = clientStreamingVideo;
32801
+ this.serverStreamingAudio = serverStreamingAudio;
32802
+ this.serverStreamingVideo = serverStreamingVideo;
32803
+ this.uneeqMessageType = UneeqMessageType.ClientMediaStreamUpdate;
32836
32804
  }
32837
-
32838
- if (code) {
32839
- props.code = code;
32805
+ }
32806
+ exports.ClientMediaStreamUpdateMessage = ClientMediaStreamUpdateMessage;
32807
+ /**
32808
+ * These WebRTC statistics help identify if session quality is being impacted by client-side conditions.
32809
+ * Messages are sent every 5 seconds, and are visible in the console if enableClientPerformanceMessage = true.
32810
+ */
32811
+ class ClientPerformanceMessage {
32812
+ constructor(clientPerformance) {
32813
+ this.clientPerformance = clientPerformance;
32814
+ this.uneeqMessageType = UneeqMessageType.ClientPerformanceMessage;
32840
32815
  }
32841
-
32842
- try {
32843
- return assign(err, props);
32844
- } catch (_) {
32845
- props.message = err.message;
32846
- props.stack = err.stack;
32847
-
32848
- const ErrClass = function () {};
32849
-
32850
- ErrClass.prototype = Object.create(Object.getPrototypeOf(err));
32851
-
32852
- // @ts-ignore
32853
- const output = assign(new ErrClass(), props);
32854
-
32855
- return output;
32816
+ }
32817
+ exports.ClientPerformanceMessage = ClientPerformanceMessage;
32818
+ /**
32819
+ * DigitalHuman Video Error has occurred
32820
+ */
32821
+ class DigitalHumanVideoError {
32822
+ constructor(error) {
32823
+ this.error = error;
32824
+ this.uneeqMessageType = UneeqMessageType.DigitalHumanVideoError;
32856
32825
  }
32857
32826
  }
32858
-
32859
- module.exports = createError;
32827
+ exports.DigitalHumanVideoError = DigitalHumanVideoError;
32828
+ /**
32829
+ * DigitalHuman Failed to play
32830
+ */
32831
+ class DigitalHumanFailedToPlay {
32832
+ constructor() {
32833
+ this.uneeqMessageType = UneeqMessageType.DigitalHumanFailedToPlay;
32834
+ this.msg = 'Digital Human failed to play with sound. This most likely occurred because the user has ' +
32835
+ 'not yet interacted with the page and was blocked due to the browser\'s autoplay policy. Video will automatically ' +
32836
+ 'be muted and attempted to be played again.';
32837
+ }
32838
+ }
32839
+ exports.DigitalHumanFailedToPlay = DigitalHumanFailedToPlay;
32840
+ /**
32841
+ * DigitalHuman was successfully played in muted mode
32842
+ */
32843
+ class DigitalHumanPlayedInMutedModeSuccess {
32844
+ constructor() {
32845
+ this.uneeqMessageType = UneeqMessageType.DigitalHumanPlayedInMutedModeSuccess;
32846
+ this.msg = 'Digital Human was successfully played in muted mode. After the user interacts with the page you will need ' +
32847
+ 'to call unmuteDigitalHuman() to unmute the video.';
32848
+ }
32849
+ }
32850
+ exports.DigitalHumanPlayedInMutedModeSuccess = DigitalHumanPlayedInMutedModeSuccess;
32851
+ /**
32852
+ * DigitalHuman was unmuted
32853
+ */
32854
+ class DigitalHumanUnmuted {
32855
+ constructor() {
32856
+ this.uneeqMessageType = UneeqMessageType.DigitalHumanUnmuted;
32857
+ }
32858
+ }
32859
+ exports.DigitalHumanUnmuted = DigitalHumanUnmuted;
32860
32860
 
32861
32861
 
32862
32862
  /***/ }),
@@ -50991,7 +50991,7 @@ exports.MessagingService = void 0;
50991
50991
  const stompjs_1 = __webpack_require__(282);
50992
50992
  const BehaviorSubject_1 = __webpack_require__(297);
50993
50993
  const Subject_1 = __webpack_require__(299);
50994
- const logger_1 = __webpack_require__(228);
50994
+ const logger_1 = __webpack_require__(233);
50995
50995
  const messaging_state_1 = __webpack_require__(301);
50996
50996
  class MessagingService {
50997
50997
  constructor(url, _options) {
@@ -53421,7 +53421,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
53421
53421
  exports.VoiceInputManager = void 0;
53422
53422
  const operators_1 = __webpack_require__(126);
53423
53423
  const soundmeter_1 = __webpack_require__(307);
53424
- const MessageTypes_1 = __webpack_require__(227);
53424
+ const MessageTypes_1 = __webpack_require__(267);
53425
53425
  const VoiceInputMode_1 = __webpack_require__(308);
53426
53426
  class VoiceInputManager {
53427
53427
  constructor(options, api, messages, enableMicrophone) {
@@ -53518,11 +53518,23 @@ class VoiceInputManager {
53518
53518
  }
53519
53519
  apiStartRecording() {
53520
53520
  this.recording = true;
53521
- this.api.avatarStartRecording().then(() => this.messages.next(new MessageTypes_1.RecordingStartedMessage()));
53521
+ /**
53522
+ * Emit the RecordingStartedMessage immediately, don't wait for http success.
53523
+ * Server buffers the audio and will set the recording start point some time
53524
+ * back from when it receives the RecordingStart request.
53525
+ *
53526
+ * We want the users UI to update immediately when we detect they are speaking,
53527
+ * so we send the message immediately.
53528
+ */
53529
+ this.messages.next(new MessageTypes_1.RecordingStartedMessage());
53530
+ this.api.avatarStartRecording().catch(() => {
53531
+ this.recording = false;
53532
+ this.messages.next(new MessageTypes_1.RecordingStoppedMessage());
53533
+ });
53522
53534
  }
53523
53535
  apiStopRecording() {
53524
53536
  this.recording = false;
53525
- this.api.avatarStopRecording().then(() => this.messages.next(new MessageTypes_1.RecordingStoppedMessage()));
53537
+ this.api.avatarStopRecording().finally(() => this.messages.next(new MessageTypes_1.RecordingStoppedMessage()));
53526
53538
  }
53527
53539
  micActivityConnected(e) {
53528
53540
  if (e) {
@@ -53595,7 +53607,7 @@ exports.SoundMeter = void 0;
53595
53607
  // It also reports on the fraction of samples that were at or near
53596
53608
  // the top of the measurement range.
53597
53609
  const rxjs_1 = __webpack_require__(20);
53598
- const logger_1 = __webpack_require__(228);
53610
+ const logger_1 = __webpack_require__(233);
53599
53611
  class SoundMeter {
53600
53612
  constructor(context) {
53601
53613
  this.instant$ = new rxjs_1.BehaviorSubject(0);