videomail-client 13.3.3 → 13.4.1

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.
@@ -10664,7 +10664,7 @@ var __webpack_exports__ = {};
10664
10664
  var client = __webpack_require__("./node_modules/superagent/lib/client.js");
10665
10665
  var client_default = /*#__PURE__*/ __webpack_require__.n(client);
10666
10666
  var package_namespaceObject = {
10667
- rE: "13.3.3"
10667
+ rE: "13.4.1"
10668
10668
  };
10669
10669
  var defined = __webpack_require__("./node_modules/defined/index.js");
10670
10670
  var defined_default = /*#__PURE__*/ __webpack_require__.n(defined);
@@ -14952,7 +14952,8 @@ var __webpack_exports__ = {};
14952
14952
  height: void 0,
14953
14953
  facingMode: "user",
14954
14954
  facingModeButton: false,
14955
- stretch: false
14955
+ stretch: false,
14956
+ mobileBreakPoint: void 0
14956
14957
  },
14957
14958
  image: {
14958
14959
  quality: 0.42,
@@ -15102,13 +15103,17 @@ var __webpack_exports__ = {};
15102
15103
  var document_visibility = __webpack_require__("./node_modules/document-visibility/index.js");
15103
15104
  var document_visibility_default = /*#__PURE__*/ __webpack_require__.n(document_visibility);
15104
15105
  function limitHeight(height, options, calledFrom) {
15106
+ const dimension = {
15107
+ unit: "px"
15108
+ };
15105
15109
  let limitedHeight = document.documentElement.clientHeight;
15106
15110
  if (height) limitedHeight = Math.min(height, limitedHeight);
15107
15111
  if (limitedHeight < 1) throw error_createError({
15108
15112
  message: `Limited height ${limitedHeight} cannot be less than 1! (Called from ${calledFrom})`,
15109
15113
  options
15110
15114
  });
15111
- return limitedHeight;
15115
+ dimension.value = limitedHeight;
15116
+ return dimension;
15112
15117
  }
15113
15118
  const dimensions_limitHeight = limitHeight;
15114
15119
  function getOuterWidth(element) {
@@ -15122,6 +15127,9 @@ var __webpack_exports__ = {};
15122
15127
  }
15123
15128
  const dimensions_getOuterWidth = getOuterWidth;
15124
15129
  function limitWidth(element, options, width) {
15130
+ const limitedDimension = {
15131
+ unit: "px"
15132
+ };
15125
15133
  let limitedWidth;
15126
15134
  const outerWidth = dimensions_getOuterWidth(element);
15127
15135
  limitedWidth = width && "number" == typeof width ? outerWidth > 0 && outerWidth < width ? outerWidth : width : outerWidth;
@@ -15129,9 +15137,22 @@ var __webpack_exports__ = {};
15129
15137
  message: "Limited width cannot be less than 1!",
15130
15138
  options
15131
15139
  });
15132
- return limitedWidth;
15140
+ limitedDimension.value = limitedWidth;
15141
+ return limitedDimension;
15133
15142
  }
15134
15143
  const dimensions_limitWidth = limitWidth;
15144
+ function useFullWidth(mobileBreakPoint) {
15145
+ if (void 0 === mobileBreakPoint) return;
15146
+ const viewportWidth = window.innerWidth;
15147
+ if (viewportWidth < mobileBreakPoint) {
15148
+ const dimension = {
15149
+ unit: "%",
15150
+ value: 100
15151
+ };
15152
+ return dimension;
15153
+ }
15154
+ }
15155
+ const dimensions_useFullWidth = useFullWidth;
15135
15156
  var contains = __webpack_require__("./node_modules/contains/index.js");
15136
15157
  var contains_default = /*#__PURE__*/ __webpack_require__.n(contains);
15137
15158
  function disableElement(element) {
@@ -16151,15 +16172,27 @@ var __webpack_exports__ = {};
16151
16172
  this.notify("Connected");
16152
16173
  if (this.options.loadUserMediaOnRecord) this.hide();
16153
16174
  });
16175
+ this.on("WINDOW_RESIZE", ()=>{
16176
+ this.correctNotifierDimensions();
16177
+ });
16154
16178
  }
16155
16179
  correctNotifierDimensions() {
16156
16180
  if (!this.notifyElement) return;
16157
16181
  if (this.options.video.stretch) {
16182
+ const heightDimension = this.visuals.getRecorderHeight(true, true);
16158
16183
  this.notifyElement.style.width = "auto";
16159
- this.notifyElement.style.height = `${this.visuals.getRecorderHeight(true, true)}px`;
16184
+ this.notifyElement.style.height = `${heightDimension.value}${heightDimension.unit}`;
16160
16185
  } else {
16161
- this.notifyElement.style.width = `${this.visuals.getRecorderWidth(true)}px`;
16162
- this.notifyElement.style.height = `${this.visuals.getRecorderHeight(true)}px`;
16186
+ let heightDimension;
16187
+ let widthDimension = dimensions_useFullWidth(this.options.video.mobileBreakPoint);
16188
+ if (!widthDimension) {
16189
+ widthDimension = this.visuals.getRecorderWidth(true);
16190
+ heightDimension = this.visuals.getRecorderHeight(true);
16191
+ }
16192
+ if (widthDimension) this.notifyElement.style.width = `${widthDimension.value}${widthDimension.unit}`;
16193
+ else this.notifyElement.style.removeProperty("width");
16194
+ if (heightDimension) this.notifyElement.style.height = `${heightDimension.value}${heightDimension.unit}`;
16195
+ else this.notifyElement.style.removeProperty("height");
16163
16196
  }
16164
16197
  }
16165
16198
  show() {
@@ -16373,7 +16406,7 @@ var __webpack_exports__ = {};
16373
16406
  function figureMinHeight(height, options) {
16374
16407
  let minHeight;
16375
16408
  if (options.video.height) {
16376
- minHeight = Math.min(options.video.height, height);
16409
+ minHeight = height ? Math.min(options.video.height, height) : options.video.height;
16377
16410
  if (minHeight < 1) throw error_createError({
16378
16411
  message: `Got a min height less than 1 (${minHeight})!`,
16379
16412
  options
@@ -16394,24 +16427,38 @@ var __webpack_exports__ = {};
16394
16427
  }
16395
16428
  const dimensions_getRatio = getRatio;
16396
16429
  function calculateHeight(responsive, videoWidth, options, target, ratio, element) {
16430
+ const dimension = {
16431
+ unit: "px"
16432
+ };
16397
16433
  let width = videoWidth;
16398
16434
  if (width < 1) throw error_createError({
16399
16435
  message: `Unable to calculate height for target ${target} when width is less than 1 (= ${width}) and responsive mode is set to ${responsive}`,
16400
16436
  options
16401
16437
  });
16402
- if (responsive && element) width = dimensions_limitWidth(element, options, width);
16438
+ if (responsive && element) {
16439
+ const limitedDimension = dimensions_limitWidth(element, options, width);
16440
+ width = limitedDimension.value;
16441
+ }
16403
16442
  const chosenRatio = null != ratio ? ratio : dimensions_getRatio(options, void 0, videoWidth);
16404
- const height = Math.round(width * chosenRatio);
16405
- if (Number.isInteger(height) && height < 1) throw error_createError({
16443
+ const height = width ? Math.round(width * chosenRatio) : void 0;
16444
+ if (height && Number.isInteger(height) && height < 1) throw error_createError({
16406
16445
  message: "Just calculated a height less than 1 which is wrong.",
16407
16446
  options
16408
16447
  });
16409
- return dimensions_figureMinHeight(height, options);
16448
+ const minHeight = dimensions_figureMinHeight(height, options);
16449
+ dimension.value = minHeight;
16450
+ return dimension;
16410
16451
  }
16411
16452
  const dimensions_calculateHeight = calculateHeight;
16412
16453
  function calculateWidth(responsive, videoHeight, options, ratio) {
16454
+ const dimension = {
16455
+ unit: "px"
16456
+ };
16413
16457
  let height = dimensions_figureMinHeight(videoHeight, options);
16414
- if (responsive) height = dimensions_limitHeight(height, options, "calculateWidth");
16458
+ if (responsive) {
16459
+ const limitedDimension = dimensions_limitHeight(height, options, "calculateWidth");
16460
+ height = limitedDimension.value;
16461
+ }
16415
16462
  if (!height || height < 1) throw error_createError({
16416
16463
  message: `Height ${height} cannot be smaller than 1 when calculating width.`,
16417
16464
  options
@@ -16422,7 +16469,8 @@ var __webpack_exports__ = {};
16422
16469
  message: "Calculated width cannot be smaller than 1!",
16423
16470
  options
16424
16471
  });
16425
- return calculatedWidth;
16472
+ dimension.value = calculatedWidth;
16473
+ return dimension;
16426
16474
  }
16427
16475
  const dimensions_calculateWidth = calculateWidth;
16428
16476
  class audio_sample_modern_t {
@@ -16779,8 +16827,8 @@ var __webpack_exports__ = {};
16779
16827
  }
16780
16828
  createCanvas() {
16781
16829
  const canvas = document.createElement("canvas");
16782
- const rawWidth = this.getRawWidth(true);
16783
- if (rawWidth) canvas.width = rawWidth;
16830
+ const dimension = this.getRawWidth(true);
16831
+ if (dimension.value) canvas.width = dimension.value;
16784
16832
  const rawHeight = this.getRawHeight(true);
16785
16833
  if (rawHeight) canvas.height = rawHeight;
16786
16834
  return canvas;
@@ -16799,14 +16847,25 @@ var __webpack_exports__ = {};
16799
16847
  }
16800
16848
  getRawWidth(responsive) {
16801
16849
  let rawWidth = this.getVideoWidth();
16802
- if (this.options.video.width || this.options.video.height) rawWidth = responsive ? this.recorder.calculateWidth(responsive) : this.options.video.width;
16803
- if (responsive) rawWidth = this.recorder.limitWidth(rawWidth);
16804
- return rawWidth;
16850
+ const dimension = {
16851
+ unit: "px"
16852
+ };
16853
+ if (this.options.video.width || this.options.video.height) if (responsive) {
16854
+ const dimension = this.recorder.calculateWidth(responsive);
16855
+ rawWidth = dimension.value;
16856
+ } else rawWidth = this.options.video.width;
16857
+ if (responsive) {
16858
+ const dimension = this.recorder.limitWidth(rawWidth);
16859
+ rawWidth = null == dimension ? void 0 : dimension.value;
16860
+ }
16861
+ dimension.value = rawWidth;
16862
+ return dimension;
16805
16863
  }
16806
16864
  getRawHeight(responsive) {
16807
16865
  let rawHeight;
16808
16866
  if (this.options.video.width || this.options.video.height) {
16809
- rawHeight = this.recorder.calculateHeight(responsive);
16867
+ const heightDimension = this.recorder.calculateHeight(responsive);
16868
+ rawHeight = heightDimension.value;
16810
16869
  if (!rawHeight || rawHeight < 1) throw error_createError({
16811
16870
  message: "Bad dimensions",
16812
16871
  explanation: "Calculated raw height cannot be less than 1!",
@@ -16820,7 +16879,10 @@ var __webpack_exports__ = {};
16820
16879
  options: this.options
16821
16880
  });
16822
16881
  }
16823
- if (responsive) rawHeight = this.recorder.limitHeight(rawHeight);
16882
+ if (responsive) {
16883
+ const heightDimension = this.recorder.limitHeight(rawHeight);
16884
+ rawHeight = heightDimension.value;
16885
+ }
16824
16886
  return rawHeight;
16825
16887
  }
16826
16888
  getRawVisuals() {
@@ -17020,14 +17082,14 @@ var __webpack_exports__ = {};
17020
17082
  if (args.mp4) this.replay.setMp4Source(`${args.mp4 + constants.SITE_NAME_LABEL}/${this.options.siteName}/videomail.mp4`, true);
17021
17083
  if (args.webm) this.replay.setWebMSource(`${args.webm + constants.SITE_NAME_LABEL}/${this.options.siteName}/videomail.webm`, true);
17022
17084
  this.hide();
17023
- const width = this.getRecorderWidth(true);
17024
- const height = this.getRecorderHeight(true);
17085
+ const widthDimension = this.getRecorderWidth(true);
17086
+ const heightDimension = this.getRecorderHeight(true);
17025
17087
  var _args_duration;
17026
17088
  const duration = null != (_args_duration = args.duration) ? _args_duration : -1;
17027
17089
  this.emit("PREVIEW", {
17028
17090
  key: this.key,
17029
- width,
17030
- height,
17091
+ width: null == widthDimension ? void 0 : widthDimension.value,
17092
+ height: heightDimension.value,
17031
17093
  hasAudio,
17032
17094
  duration
17033
17095
  });
@@ -17210,8 +17272,8 @@ var __webpack_exports__ = {};
17210
17272
  };
17211
17273
  } else if (constraints.video && true !== constraints.video) {
17212
17274
  const limitedWidth = this.limitWidth();
17213
- if (limitedWidth) constraints.video.width = {
17214
- ideal: limitedWidth
17275
+ if (null == limitedWidth ? void 0 : limitedWidth.value) constraints.video.width = {
17276
+ ideal: limitedWidth.value
17215
17277
  };
17216
17278
  }
17217
17279
  if (this.options.video.height && constraints.video && true !== constraints.video) {
@@ -17635,13 +17697,21 @@ var __webpack_exports__ = {};
17635
17697
  }
17636
17698
  correctDimensions() {
17637
17699
  if (!this.recorderElement) return;
17638
- if (this.options.video.width) {
17639
- const recorderWidth = this.getRecorderWidth(true);
17640
- if (recorderWidth) this.recorderElement.width = recorderWidth;
17641
- }
17642
- if (this.options.video.height) {
17643
- const recorderHeight = this.getRecorderHeight(true);
17644
- if (recorderHeight) this.recorderElement.height = recorderHeight;
17700
+ const widthDimension = dimensions_useFullWidth(this.options.video.mobileBreakPoint);
17701
+ if (this.options.video.stretch || widthDimension) {
17702
+ this.recorderElement.style.width = "100%";
17703
+ this.recorderElement.style.removeProperty("height");
17704
+ } else {
17705
+ if (this.options.video.width) {
17706
+ const recorderWidth = this.getRecorderWidth(true);
17707
+ if (null == recorderWidth ? void 0 : recorderWidth.value) this.recorderElement.width = recorderWidth.value;
17708
+ else this.recorderElement.style.removeProperty("width");
17709
+ }
17710
+ if (this.options.video.height) {
17711
+ const recorderHeight = this.getRecorderHeight(true);
17712
+ if (recorderHeight.value) this.recorderElement.height = recorderHeight.value;
17713
+ else this.recorderElement.style.removeProperty("height");
17714
+ }
17645
17715
  }
17646
17716
  }
17647
17717
  switchFacingMode() {
@@ -17689,6 +17759,9 @@ var __webpack_exports__ = {};
17689
17759
  this.on("SWITCH_FACING_MODE", ()=>{
17690
17760
  this.switchFacingMode();
17691
17761
  });
17762
+ this.on("WINDOW_RESIZE", ()=>{
17763
+ this.correctDimensions();
17764
+ });
17692
17765
  }
17693
17766
  buildElement() {
17694
17767
  this.recorderElement = document.createElement("video");
@@ -17707,7 +17780,6 @@ var __webpack_exports__ = {};
17707
17780
  this.recorderElement.style.transform = "rotateY(180deg)";
17708
17781
  this.recorderElement.style["-webkit-transform"] = "rotateY(180deg)";
17709
17782
  this.recorderElement.style["-moz-transform"] = "rotateY(180deg)";
17710
- if (this.options.video.stretch) this.recorderElement.style.width = "100%";
17711
17783
  null != this.userMedia || (this.userMedia = new visuals_userMedia(this, this.options));
17712
17784
  this.show();
17713
17785
  if (this.built) {
@@ -17742,13 +17814,36 @@ var __webpack_exports__ = {};
17742
17814
  var _this_userMedia;
17743
17815
  if (null == (_this_userMedia = this.userMedia) ? void 0 : _this_userMedia.hasVideoWidth()) return this.userMedia.getRawWidth(responsive);
17744
17816
  if (responsive && this.options.video.width) return this.limitWidth(this.options.video.width);
17745
- return this.options.video.width;
17817
+ const dimension = {
17818
+ unit: "px",
17819
+ value: this.options.video.width
17820
+ };
17821
+ return dimension;
17746
17822
  }
17747
17823
  getRecorderHeight(responsive, useBoundingClientRect) {
17748
- if (this.recorderElement && useBoundingClientRect) return this.recorderElement.getBoundingClientRect().height;
17749
- if (this.userMedia) return this.userMedia.getRawHeight(responsive);
17824
+ if (this.recorderElement && useBoundingClientRect) {
17825
+ const height = this.recorderElement.getBoundingClientRect().height;
17826
+ const dimension = {
17827
+ unit: "px",
17828
+ value: height
17829
+ };
17830
+ return dimension;
17831
+ }
17832
+ if (this.userMedia) {
17833
+ const height = this.userMedia.getRawHeight(responsive);
17834
+ const dimension = {
17835
+ unit: "px",
17836
+ value: height
17837
+ };
17838
+ return dimension;
17839
+ }
17750
17840
  if (responsive && this.options.video.height) return this.calculateHeight(responsive);
17751
- return this.options.video.height;
17841
+ const height = this.options.video.height;
17842
+ const dimension = {
17843
+ unit: "px",
17844
+ value: height
17845
+ };
17846
+ return dimension;
17752
17847
  }
17753
17848
  getRatio() {
17754
17849
  let ratio;
@@ -18126,13 +18221,24 @@ var __webpack_exports__ = {};
18126
18221
  this.on("ERROR", ()=>{
18127
18222
  if (util_getBrowser(this.options).isMobile()) this.removeDimensions();
18128
18223
  });
18224
+ this.on("WINDOW_RESIZE", ()=>{
18225
+ this.correctDimensions();
18226
+ });
18129
18227
  }
18130
18228
  }
18131
18229
  correctDimensions() {
18132
18230
  if (this.options.video.stretch) this.removeDimensions();
18133
18231
  else if (this.visualsElement) {
18134
- this.visualsElement.style.width = `${this.getRecorderWidth(true)}px`;
18135
- this.visualsElement.style.height = `${this.getRecorderHeight(true)}px`;
18232
+ let heightDimension;
18233
+ let widthDimension = dimensions_useFullWidth(this.options.video.mobileBreakPoint);
18234
+ if (!widthDimension) {
18235
+ widthDimension = this.getRecorderWidth(true);
18236
+ heightDimension = this.getRecorderHeight(true);
18237
+ }
18238
+ if (widthDimension) this.visualsElement.style.width = `${widthDimension.value}${widthDimension.unit}`;
18239
+ else this.visualsElement.style.removeProperty("width");
18240
+ if (heightDimension) this.visualsElement.style.height = `${heightDimension.value}${heightDimension.unit}`;
18241
+ else this.visualsElement.style.removeProperty("height");
18136
18242
  }
18137
18243
  }
18138
18244
  removeDimensions() {
@@ -18473,6 +18579,9 @@ var __webpack_exports__ = {};
18473
18579
  }
18474
18580
  initEvents(playerOnly = false) {
18475
18581
  this.options.logger.debug(`Container: initEvents (playerOnly = ${playerOnly})`);
18582
+ window.addEventListener("resize", ()=>{
18583
+ this.emit("WINDOW_RESIZE");
18584
+ });
18476
18585
  if (this.options.enableAutoUnload) window.addEventListener("beforeunload", (e)=>{
18477
18586
  this.unload({
18478
18587
  e
@@ -18510,6 +18619,9 @@ var __webpack_exports__ = {};
18510
18619
  const browser = util_getBrowser(this.options);
18511
18620
  if (browser.isMobile()) this.removeDimensions();
18512
18621
  });
18622
+ this.on("WINDOW_RESIZE", ()=>{
18623
+ this.correctDimensions();
18624
+ });
18513
18625
  if (!playerOnly) this.on("LOADED_META_DATA", ()=>{
18514
18626
  this.correctDimensions();
18515
18627
  });
@@ -18517,8 +18629,10 @@ var __webpack_exports__ = {};
18517
18629
  correctDimensions() {
18518
18630
  if (this.options.video.stretch) this.removeDimensions();
18519
18631
  else if (this.containerElement) {
18520
- const width = this.visuals.getRecorderWidth(true);
18521
- if (width) this.containerElement.style.width = `${width}px`;
18632
+ let widthDimension = dimensions_useFullWidth(this.options.video.mobileBreakPoint);
18633
+ if (!widthDimension) widthDimension = this.visuals.getRecorderWidth(true);
18634
+ if (null == widthDimension ? void 0 : widthDimension.value) this.containerElement.style.width = `${widthDimension.value}${widthDimension.unit}`;
18635
+ else this.containerElement.style.removeProperty("width");
18522
18636
  }
18523
18637
  }
18524
18638
  removeDimensions() {
@@ -18544,8 +18658,10 @@ var __webpack_exports__ = {};
18544
18658
  if (!videomailFormData) throw new Error("No videomail form data defined");
18545
18659
  if (method === FormMethod.POST) {
18546
18660
  videomailFormData.recordingStats = this.visuals.getRecordingStats();
18547
- videomailFormData.width = this.visuals.getRecorderWidth(true);
18548
- videomailFormData.height = this.visuals.getRecorderHeight(true);
18661
+ const widthDimension = this.visuals.getRecorderWidth(true);
18662
+ const heightDimension = this.visuals.getRecorderHeight(true);
18663
+ videomailFormData.width = null == widthDimension ? void 0 : widthDimension.value;
18664
+ videomailFormData.height = heightDimension.value;
18549
18665
  return yield this.resource.post(videomailFormData);
18550
18666
  }
18551
18667
  if (method === FormMethod.PUT) return yield this.resource.put(videomailFormData);