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.
- package/dist/cjs/index.cjs +161 -45
- package/dist/esm/index.js +161 -45
- package/dist/esm/types/dimension.d.ts +8 -0
- package/dist/esm/types/events/index.d.ts +1 -0
- package/dist/esm/types/options.d.ts +1 -0
- package/dist/esm/util/Despot.d.ts +1 -0
- package/dist/esm/util/html/dimensions/calculateHeight.d.ts +2 -1
- package/dist/esm/util/html/dimensions/calculateWidth.d.ts +2 -1
- package/dist/esm/util/html/dimensions/figureMinHeight.d.ts +1 -1
- package/dist/esm/util/html/dimensions/limitHeight.d.ts +2 -1
- package/dist/esm/util/html/dimensions/limitWidth.d.ts +2 -1
- package/dist/esm/util/html/dimensions/useFullWidth.d.ts +3 -0
- package/dist/esm/wrappers/container.d.ts +2 -2
- package/dist/esm/wrappers/visuals/recorder.d.ts +7 -6
- package/dist/esm/wrappers/visuals/userMedia.d.ts +3 -2
- package/dist/esm/wrappers/visuals.d.ts +5 -4
- package/dist/umd/index.js +161 -45
- package/package.json +7 -7
package/dist/esm/index.js
CHANGED
|
@@ -3606,7 +3606,7 @@ const constants = {
|
|
|
3606
3606
|
}
|
|
3607
3607
|
};
|
|
3608
3608
|
var package_namespaceObject = {
|
|
3609
|
-
rE: "13.
|
|
3609
|
+
rE: "13.4.1"
|
|
3610
3610
|
};
|
|
3611
3611
|
function canPlayType_canPlayType(video, type) {
|
|
3612
3612
|
const canPlayType = video.canPlayType(`video/${type}`);
|
|
@@ -4492,7 +4492,8 @@ const options_options = {
|
|
|
4492
4492
|
height: void 0,
|
|
4493
4493
|
facingMode: "user",
|
|
4494
4494
|
facingModeButton: false,
|
|
4495
|
-
stretch: false
|
|
4495
|
+
stretch: false,
|
|
4496
|
+
mobileBreakPoint: void 0
|
|
4496
4497
|
},
|
|
4497
4498
|
image: {
|
|
4498
4499
|
quality: 0.42,
|
|
@@ -4630,13 +4631,17 @@ main_options.insertStyleElement = insertStyleElement_default();
|
|
|
4630
4631
|
injectStylesIntoStyleTag_default()(main.A, main_options);
|
|
4631
4632
|
main.A && main.A.locals && main.A.locals;
|
|
4632
4633
|
function limitHeight(height, options, calledFrom) {
|
|
4634
|
+
const dimension = {
|
|
4635
|
+
unit: "px"
|
|
4636
|
+
};
|
|
4633
4637
|
let limitedHeight = document.documentElement.clientHeight;
|
|
4634
4638
|
if (height) limitedHeight = Math.min(height, limitedHeight);
|
|
4635
4639
|
if (limitedHeight < 1) throw error_createError({
|
|
4636
4640
|
message: `Limited height ${limitedHeight} cannot be less than 1! (Called from ${calledFrom})`,
|
|
4637
4641
|
options
|
|
4638
4642
|
});
|
|
4639
|
-
|
|
4643
|
+
dimension.value = limitedHeight;
|
|
4644
|
+
return dimension;
|
|
4640
4645
|
}
|
|
4641
4646
|
const dimensions_limitHeight = limitHeight;
|
|
4642
4647
|
function getOuterWidth(element) {
|
|
@@ -4650,6 +4655,9 @@ function getOuterWidth(element) {
|
|
|
4650
4655
|
}
|
|
4651
4656
|
const dimensions_getOuterWidth = getOuterWidth;
|
|
4652
4657
|
function limitWidth(element, options, width) {
|
|
4658
|
+
const limitedDimension = {
|
|
4659
|
+
unit: "px"
|
|
4660
|
+
};
|
|
4653
4661
|
let limitedWidth;
|
|
4654
4662
|
const outerWidth = dimensions_getOuterWidth(element);
|
|
4655
4663
|
limitedWidth = width && "number" == typeof width ? outerWidth > 0 && outerWidth < width ? outerWidth : width : outerWidth;
|
|
@@ -4657,9 +4665,22 @@ function limitWidth(element, options, width) {
|
|
|
4657
4665
|
message: "Limited width cannot be less than 1!",
|
|
4658
4666
|
options
|
|
4659
4667
|
});
|
|
4660
|
-
|
|
4668
|
+
limitedDimension.value = limitedWidth;
|
|
4669
|
+
return limitedDimension;
|
|
4661
4670
|
}
|
|
4662
4671
|
const dimensions_limitWidth = limitWidth;
|
|
4672
|
+
function useFullWidth(mobileBreakPoint) {
|
|
4673
|
+
if (void 0 === mobileBreakPoint) return;
|
|
4674
|
+
const viewportWidth = window.innerWidth;
|
|
4675
|
+
if (viewportWidth < mobileBreakPoint) {
|
|
4676
|
+
const dimension = {
|
|
4677
|
+
unit: "%",
|
|
4678
|
+
value: 100
|
|
4679
|
+
};
|
|
4680
|
+
return dimension;
|
|
4681
|
+
}
|
|
4682
|
+
}
|
|
4683
|
+
const dimensions_useFullWidth = useFullWidth;
|
|
4663
4684
|
function disableElement(element) {
|
|
4664
4685
|
if (!element) return;
|
|
4665
4686
|
if ("INPUT" === element.tagName || "BUTTON" === element.tagName) element.setAttribute("disabled", "true");
|
|
@@ -5585,15 +5606,27 @@ class Notifier extends util_Despot {
|
|
|
5585
5606
|
this.notify("Connected");
|
|
5586
5607
|
if (this.options.loadUserMediaOnRecord) this.hide();
|
|
5587
5608
|
});
|
|
5609
|
+
this.on("WINDOW_RESIZE", ()=>{
|
|
5610
|
+
this.correctNotifierDimensions();
|
|
5611
|
+
});
|
|
5588
5612
|
}
|
|
5589
5613
|
correctNotifierDimensions() {
|
|
5590
5614
|
if (!this.notifyElement) return;
|
|
5591
5615
|
if (this.options.video.stretch) {
|
|
5616
|
+
const heightDimension = this.visuals.getRecorderHeight(true, true);
|
|
5592
5617
|
this.notifyElement.style.width = "auto";
|
|
5593
|
-
this.notifyElement.style.height = `${
|
|
5618
|
+
this.notifyElement.style.height = `${heightDimension.value}${heightDimension.unit}`;
|
|
5594
5619
|
} else {
|
|
5595
|
-
|
|
5596
|
-
|
|
5620
|
+
let heightDimension;
|
|
5621
|
+
let widthDimension = dimensions_useFullWidth(this.options.video.mobileBreakPoint);
|
|
5622
|
+
if (!widthDimension) {
|
|
5623
|
+
widthDimension = this.visuals.getRecorderWidth(true);
|
|
5624
|
+
heightDimension = this.visuals.getRecorderHeight(true);
|
|
5625
|
+
}
|
|
5626
|
+
if (widthDimension) this.notifyElement.style.width = `${widthDimension.value}${widthDimension.unit}`;
|
|
5627
|
+
else this.notifyElement.style.removeProperty("width");
|
|
5628
|
+
if (heightDimension) this.notifyElement.style.height = `${heightDimension.value}${heightDimension.unit}`;
|
|
5629
|
+
else this.notifyElement.style.removeProperty("height");
|
|
5597
5630
|
}
|
|
5598
5631
|
}
|
|
5599
5632
|
show() {
|
|
@@ -5732,7 +5765,7 @@ const notifier = Notifier;
|
|
|
5732
5765
|
function figureMinHeight(height, options) {
|
|
5733
5766
|
let minHeight;
|
|
5734
5767
|
if (options.video.height) {
|
|
5735
|
-
minHeight = Math.min(options.video.height, height);
|
|
5768
|
+
minHeight = height ? Math.min(options.video.height, height) : options.video.height;
|
|
5736
5769
|
if (minHeight < 1) throw error_createError({
|
|
5737
5770
|
message: `Got a min height less than 1 (${minHeight})!`,
|
|
5738
5771
|
options
|
|
@@ -5753,24 +5786,38 @@ function getRatio(options, videoHeight, videoWidth) {
|
|
|
5753
5786
|
}
|
|
5754
5787
|
const dimensions_getRatio = getRatio;
|
|
5755
5788
|
function calculateHeight(responsive, videoWidth, options, target, ratio, element) {
|
|
5789
|
+
const dimension = {
|
|
5790
|
+
unit: "px"
|
|
5791
|
+
};
|
|
5756
5792
|
let width = videoWidth;
|
|
5757
5793
|
if (width < 1) throw error_createError({
|
|
5758
5794
|
message: `Unable to calculate height for target ${target} when width is less than 1 (= ${width}) and responsive mode is set to ${responsive}`,
|
|
5759
5795
|
options
|
|
5760
5796
|
});
|
|
5761
|
-
if (responsive && element)
|
|
5797
|
+
if (responsive && element) {
|
|
5798
|
+
const limitedDimension = dimensions_limitWidth(element, options, width);
|
|
5799
|
+
width = limitedDimension.value;
|
|
5800
|
+
}
|
|
5762
5801
|
const chosenRatio = ratio ?? dimensions_getRatio(options, void 0, videoWidth);
|
|
5763
|
-
const height = Math.round(width * chosenRatio);
|
|
5764
|
-
if (Number.isInteger(height) && height < 1) throw error_createError({
|
|
5802
|
+
const height = width ? Math.round(width * chosenRatio) : void 0;
|
|
5803
|
+
if (height && Number.isInteger(height) && height < 1) throw error_createError({
|
|
5765
5804
|
message: "Just calculated a height less than 1 which is wrong.",
|
|
5766
5805
|
options
|
|
5767
5806
|
});
|
|
5768
|
-
|
|
5807
|
+
const minHeight = dimensions_figureMinHeight(height, options);
|
|
5808
|
+
dimension.value = minHeight;
|
|
5809
|
+
return dimension;
|
|
5769
5810
|
}
|
|
5770
5811
|
const dimensions_calculateHeight = calculateHeight;
|
|
5771
5812
|
function calculateWidth(responsive, videoHeight, options, ratio) {
|
|
5813
|
+
const dimension = {
|
|
5814
|
+
unit: "px"
|
|
5815
|
+
};
|
|
5772
5816
|
let height = dimensions_figureMinHeight(videoHeight, options);
|
|
5773
|
-
if (responsive)
|
|
5817
|
+
if (responsive) {
|
|
5818
|
+
const limitedDimension = dimensions_limitHeight(height, options, "calculateWidth");
|
|
5819
|
+
height = limitedDimension.value;
|
|
5820
|
+
}
|
|
5774
5821
|
if (!height || height < 1) throw error_createError({
|
|
5775
5822
|
message: `Height ${height} cannot be smaller than 1 when calculating width.`,
|
|
5776
5823
|
options
|
|
@@ -5781,7 +5828,8 @@ function calculateWidth(responsive, videoHeight, options, ratio) {
|
|
|
5781
5828
|
message: "Calculated width cannot be smaller than 1!",
|
|
5782
5829
|
options
|
|
5783
5830
|
});
|
|
5784
|
-
|
|
5831
|
+
dimension.value = calculatedWidth;
|
|
5832
|
+
return dimension;
|
|
5785
5833
|
}
|
|
5786
5834
|
const dimensions_calculateWidth = calculateWidth;
|
|
5787
5835
|
const CHANNELS = 1;
|
|
@@ -6108,8 +6156,8 @@ class UserMedia extends util_Despot {
|
|
|
6108
6156
|
}
|
|
6109
6157
|
createCanvas() {
|
|
6110
6158
|
const canvas = document.createElement("canvas");
|
|
6111
|
-
const
|
|
6112
|
-
if (
|
|
6159
|
+
const dimension = this.getRawWidth(true);
|
|
6160
|
+
if (dimension.value) canvas.width = dimension.value;
|
|
6113
6161
|
const rawHeight = this.getRawHeight(true);
|
|
6114
6162
|
if (rawHeight) canvas.height = rawHeight;
|
|
6115
6163
|
return canvas;
|
|
@@ -6128,14 +6176,25 @@ class UserMedia extends util_Despot {
|
|
|
6128
6176
|
}
|
|
6129
6177
|
getRawWidth(responsive) {
|
|
6130
6178
|
let rawWidth = this.getVideoWidth();
|
|
6131
|
-
|
|
6132
|
-
|
|
6133
|
-
|
|
6179
|
+
const dimension = {
|
|
6180
|
+
unit: "px"
|
|
6181
|
+
};
|
|
6182
|
+
if (this.options.video.width || this.options.video.height) if (responsive) {
|
|
6183
|
+
const dimension = this.recorder.calculateWidth(responsive);
|
|
6184
|
+
rawWidth = dimension.value;
|
|
6185
|
+
} else rawWidth = this.options.video.width;
|
|
6186
|
+
if (responsive) {
|
|
6187
|
+
const dimension = this.recorder.limitWidth(rawWidth);
|
|
6188
|
+
rawWidth = dimension?.value;
|
|
6189
|
+
}
|
|
6190
|
+
dimension.value = rawWidth;
|
|
6191
|
+
return dimension;
|
|
6134
6192
|
}
|
|
6135
6193
|
getRawHeight(responsive) {
|
|
6136
6194
|
let rawHeight;
|
|
6137
6195
|
if (this.options.video.width || this.options.video.height) {
|
|
6138
|
-
|
|
6196
|
+
const heightDimension = this.recorder.calculateHeight(responsive);
|
|
6197
|
+
rawHeight = heightDimension.value;
|
|
6139
6198
|
if (!rawHeight || rawHeight < 1) throw error_createError({
|
|
6140
6199
|
message: "Bad dimensions",
|
|
6141
6200
|
explanation: "Calculated raw height cannot be less than 1!",
|
|
@@ -6149,7 +6208,10 @@ class UserMedia extends util_Despot {
|
|
|
6149
6208
|
options: this.options
|
|
6150
6209
|
});
|
|
6151
6210
|
}
|
|
6152
|
-
if (responsive)
|
|
6211
|
+
if (responsive) {
|
|
6212
|
+
const heightDimension = this.recorder.limitHeight(rawHeight);
|
|
6213
|
+
rawHeight = heightDimension.value;
|
|
6214
|
+
}
|
|
6153
6215
|
return rawHeight;
|
|
6154
6216
|
}
|
|
6155
6217
|
getRawVisuals() {
|
|
@@ -6368,13 +6430,13 @@ class Recorder extends util_Despot {
|
|
|
6368
6430
|
if (args.mp4) this.replay.setMp4Source(`${args.mp4 + constants.SITE_NAME_LABEL}/${this.options.siteName}/videomail.mp4`, true);
|
|
6369
6431
|
if (args.webm) this.replay.setWebMSource(`${args.webm + constants.SITE_NAME_LABEL}/${this.options.siteName}/videomail.webm`, true);
|
|
6370
6432
|
this.hide();
|
|
6371
|
-
const
|
|
6372
|
-
const
|
|
6433
|
+
const widthDimension = this.getRecorderWidth(true);
|
|
6434
|
+
const heightDimension = this.getRecorderHeight(true);
|
|
6373
6435
|
const duration = args.duration ?? -1;
|
|
6374
6436
|
this.emit("PREVIEW", {
|
|
6375
6437
|
key: this.key,
|
|
6376
|
-
width,
|
|
6377
|
-
height,
|
|
6438
|
+
width: widthDimension?.value,
|
|
6439
|
+
height: heightDimension.value,
|
|
6378
6440
|
hasAudio,
|
|
6379
6441
|
duration
|
|
6380
6442
|
});
|
|
@@ -6555,8 +6617,8 @@ class Recorder extends util_Despot {
|
|
|
6555
6617
|
};
|
|
6556
6618
|
} else if (constraints.video && true !== constraints.video) {
|
|
6557
6619
|
const limitedWidth = this.limitWidth();
|
|
6558
|
-
if (limitedWidth) constraints.video.width = {
|
|
6559
|
-
ideal: limitedWidth
|
|
6620
|
+
if (limitedWidth?.value) constraints.video.width = {
|
|
6621
|
+
ideal: limitedWidth.value
|
|
6560
6622
|
};
|
|
6561
6623
|
}
|
|
6562
6624
|
if (this.options.video.height && constraints.video && true !== constraints.video) {
|
|
@@ -6970,13 +7032,21 @@ class Recorder extends util_Despot {
|
|
|
6970
7032
|
}
|
|
6971
7033
|
correctDimensions() {
|
|
6972
7034
|
if (!this.recorderElement) return;
|
|
6973
|
-
|
|
6974
|
-
|
|
6975
|
-
|
|
6976
|
-
|
|
6977
|
-
|
|
6978
|
-
|
|
6979
|
-
|
|
7035
|
+
const widthDimension = dimensions_useFullWidth(this.options.video.mobileBreakPoint);
|
|
7036
|
+
if (this.options.video.stretch || widthDimension) {
|
|
7037
|
+
this.recorderElement.style.width = "100%";
|
|
7038
|
+
this.recorderElement.style.removeProperty("height");
|
|
7039
|
+
} else {
|
|
7040
|
+
if (this.options.video.width) {
|
|
7041
|
+
const recorderWidth = this.getRecorderWidth(true);
|
|
7042
|
+
if (recorderWidth?.value) this.recorderElement.width = recorderWidth.value;
|
|
7043
|
+
else this.recorderElement.style.removeProperty("width");
|
|
7044
|
+
}
|
|
7045
|
+
if (this.options.video.height) {
|
|
7046
|
+
const recorderHeight = this.getRecorderHeight(true);
|
|
7047
|
+
if (recorderHeight.value) this.recorderElement.height = recorderHeight.value;
|
|
7048
|
+
else this.recorderElement.style.removeProperty("height");
|
|
7049
|
+
}
|
|
6980
7050
|
}
|
|
6981
7051
|
}
|
|
6982
7052
|
switchFacingMode() {
|
|
@@ -7024,6 +7094,9 @@ class Recorder extends util_Despot {
|
|
|
7024
7094
|
this.on("SWITCH_FACING_MODE", ()=>{
|
|
7025
7095
|
this.switchFacingMode();
|
|
7026
7096
|
});
|
|
7097
|
+
this.on("WINDOW_RESIZE", ()=>{
|
|
7098
|
+
this.correctDimensions();
|
|
7099
|
+
});
|
|
7027
7100
|
}
|
|
7028
7101
|
buildElement() {
|
|
7029
7102
|
this.recorderElement = document.createElement("video");
|
|
@@ -7041,7 +7114,6 @@ class Recorder extends util_Despot {
|
|
|
7041
7114
|
this.recorderElement.style.transform = "rotateY(180deg)";
|
|
7042
7115
|
this.recorderElement.style["-webkit-transform"] = "rotateY(180deg)";
|
|
7043
7116
|
this.recorderElement.style["-moz-transform"] = "rotateY(180deg)";
|
|
7044
|
-
if (this.options.video.stretch) this.recorderElement.style.width = "100%";
|
|
7045
7117
|
this.userMedia ??= new visuals_userMedia(this, this.options);
|
|
7046
7118
|
this.show();
|
|
7047
7119
|
if (this.built) {
|
|
@@ -7073,13 +7145,36 @@ class Recorder extends util_Despot {
|
|
|
7073
7145
|
getRecorderWidth(responsive) {
|
|
7074
7146
|
if (this.userMedia?.hasVideoWidth()) return this.userMedia.getRawWidth(responsive);
|
|
7075
7147
|
if (responsive && this.options.video.width) return this.limitWidth(this.options.video.width);
|
|
7076
|
-
|
|
7148
|
+
const dimension = {
|
|
7149
|
+
unit: "px",
|
|
7150
|
+
value: this.options.video.width
|
|
7151
|
+
};
|
|
7152
|
+
return dimension;
|
|
7077
7153
|
}
|
|
7078
7154
|
getRecorderHeight(responsive, useBoundingClientRect) {
|
|
7079
|
-
if (this.recorderElement && useBoundingClientRect)
|
|
7080
|
-
|
|
7155
|
+
if (this.recorderElement && useBoundingClientRect) {
|
|
7156
|
+
const height = this.recorderElement.getBoundingClientRect().height;
|
|
7157
|
+
const dimension = {
|
|
7158
|
+
unit: "px",
|
|
7159
|
+
value: height
|
|
7160
|
+
};
|
|
7161
|
+
return dimension;
|
|
7162
|
+
}
|
|
7163
|
+
if (this.userMedia) {
|
|
7164
|
+
const height = this.userMedia.getRawHeight(responsive);
|
|
7165
|
+
const dimension = {
|
|
7166
|
+
unit: "px",
|
|
7167
|
+
value: height
|
|
7168
|
+
};
|
|
7169
|
+
return dimension;
|
|
7170
|
+
}
|
|
7081
7171
|
if (responsive && this.options.video.height) return this.calculateHeight(responsive);
|
|
7082
|
-
|
|
7172
|
+
const height = this.options.video.height;
|
|
7173
|
+
const dimension = {
|
|
7174
|
+
unit: "px",
|
|
7175
|
+
value: height
|
|
7176
|
+
};
|
|
7177
|
+
return dimension;
|
|
7083
7178
|
}
|
|
7084
7179
|
getRatio() {
|
|
7085
7180
|
let ratio;
|
|
@@ -7430,13 +7525,24 @@ class Visuals extends util_Despot {
|
|
|
7430
7525
|
this.on("ERROR", ()=>{
|
|
7431
7526
|
if (util_getBrowser(this.options).isMobile()) this.removeDimensions();
|
|
7432
7527
|
});
|
|
7528
|
+
this.on("WINDOW_RESIZE", ()=>{
|
|
7529
|
+
this.correctDimensions();
|
|
7530
|
+
});
|
|
7433
7531
|
}
|
|
7434
7532
|
}
|
|
7435
7533
|
correctDimensions() {
|
|
7436
7534
|
if (this.options.video.stretch) this.removeDimensions();
|
|
7437
7535
|
else if (this.visualsElement) {
|
|
7438
|
-
|
|
7439
|
-
|
|
7536
|
+
let heightDimension;
|
|
7537
|
+
let widthDimension = dimensions_useFullWidth(this.options.video.mobileBreakPoint);
|
|
7538
|
+
if (!widthDimension) {
|
|
7539
|
+
widthDimension = this.getRecorderWidth(true);
|
|
7540
|
+
heightDimension = this.getRecorderHeight(true);
|
|
7541
|
+
}
|
|
7542
|
+
if (widthDimension) this.visualsElement.style.width = `${widthDimension.value}${widthDimension.unit}`;
|
|
7543
|
+
else this.visualsElement.style.removeProperty("width");
|
|
7544
|
+
if (heightDimension) this.visualsElement.style.height = `${heightDimension.value}${heightDimension.unit}`;
|
|
7545
|
+
else this.visualsElement.style.removeProperty("height");
|
|
7440
7546
|
}
|
|
7441
7547
|
}
|
|
7442
7548
|
removeDimensions() {
|
|
@@ -7744,6 +7850,9 @@ class Container extends util_Despot {
|
|
|
7744
7850
|
}
|
|
7745
7851
|
initEvents(playerOnly = false) {
|
|
7746
7852
|
this.options.logger.debug(`Container: initEvents (playerOnly = ${playerOnly})`);
|
|
7853
|
+
window.addEventListener("resize", ()=>{
|
|
7854
|
+
this.emit("WINDOW_RESIZE");
|
|
7855
|
+
});
|
|
7747
7856
|
if (this.options.enableAutoUnload) window.addEventListener("beforeunload", (e)=>{
|
|
7748
7857
|
this.unload({
|
|
7749
7858
|
e
|
|
@@ -7781,6 +7890,9 @@ class Container extends util_Despot {
|
|
|
7781
7890
|
const browser = util_getBrowser(this.options);
|
|
7782
7891
|
if (browser.isMobile()) this.removeDimensions();
|
|
7783
7892
|
});
|
|
7893
|
+
this.on("WINDOW_RESIZE", ()=>{
|
|
7894
|
+
this.correctDimensions();
|
|
7895
|
+
});
|
|
7784
7896
|
if (!playerOnly) this.on("LOADED_META_DATA", ()=>{
|
|
7785
7897
|
this.correctDimensions();
|
|
7786
7898
|
});
|
|
@@ -7788,8 +7900,10 @@ class Container extends util_Despot {
|
|
|
7788
7900
|
correctDimensions() {
|
|
7789
7901
|
if (this.options.video.stretch) this.removeDimensions();
|
|
7790
7902
|
else if (this.containerElement) {
|
|
7791
|
-
|
|
7792
|
-
if (
|
|
7903
|
+
let widthDimension = dimensions_useFullWidth(this.options.video.mobileBreakPoint);
|
|
7904
|
+
if (!widthDimension) widthDimension = this.visuals.getRecorderWidth(true);
|
|
7905
|
+
if (widthDimension?.value) this.containerElement.style.width = `${widthDimension.value}${widthDimension.unit}`;
|
|
7906
|
+
else this.containerElement.style.removeProperty("width");
|
|
7793
7907
|
}
|
|
7794
7908
|
}
|
|
7795
7909
|
removeDimensions() {
|
|
@@ -7813,8 +7927,10 @@ class Container extends util_Despot {
|
|
|
7813
7927
|
if (!videomailFormData) throw new Error("No videomail form data defined");
|
|
7814
7928
|
if (method === FormMethod.POST) {
|
|
7815
7929
|
videomailFormData.recordingStats = this.visuals.getRecordingStats();
|
|
7816
|
-
|
|
7817
|
-
|
|
7930
|
+
const widthDimension = this.visuals.getRecorderWidth(true);
|
|
7931
|
+
const heightDimension = this.visuals.getRecorderHeight(true);
|
|
7932
|
+
videomailFormData.width = widthDimension?.value;
|
|
7933
|
+
videomailFormData.height = heightDimension.value;
|
|
7818
7934
|
return await this.resource.post(videomailFormData);
|
|
7819
7935
|
}
|
|
7820
7936
|
if (method === FormMethod.PUT) return await this.resource.put(videomailFormData);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
type AbsoluteUnit = "px" | "pt" | "pc" | "in" | "cm" | "mm" | "Q";
|
|
2
|
+
type RelativeUnit = "em" | "rem" | "%" | "vw" | "vh" | "vmin" | "vmax" | "ex" | "ch";
|
|
3
|
+
type CSSUnit = AbsoluteUnit | RelativeUnit;
|
|
4
|
+
export interface Dimension {
|
|
5
|
+
unit: CSSUnit;
|
|
6
|
+
value?: number | undefined;
|
|
7
|
+
}
|
|
8
|
+
export {};
|
|
@@ -52,6 +52,7 @@ declare class Despot {
|
|
|
52
52
|
VALID: (() => void)[];
|
|
53
53
|
VALIDATING: ((params?: import("../types/events").ValidatingParams) => void)[];
|
|
54
54
|
VISIBLE: (() => void)[];
|
|
55
|
+
WINDOW_RESIZE: (() => void)[];
|
|
55
56
|
}>[E];
|
|
56
57
|
protected static removeListener(eventName: keyof VideomailEvents): void;
|
|
57
58
|
protected static removeAllListeners(): void;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Dimension } from "../../../types/dimension";
|
|
1
2
|
import { VideomailClientOptions } from "../../../types/options";
|
|
2
|
-
declare function calculateHeight(responsive: boolean, videoWidth: number, options: VideomailClientOptions, target: string, ratio?: number, element?: HTMLElement | null):
|
|
3
|
+
declare function calculateHeight(responsive: boolean, videoWidth: number, options: VideomailClientOptions, target: string, ratio?: number, element?: HTMLElement | null): Dimension;
|
|
3
4
|
export default calculateHeight;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Dimension } from "../../../types/dimension";
|
|
1
2
|
import { VideomailClientOptions } from "../../../types/options";
|
|
2
|
-
declare function calculateWidth(responsive: boolean, videoHeight: number, options: VideomailClientOptions, ratio?: number):
|
|
3
|
+
declare function calculateWidth(responsive: boolean, videoHeight: number, options: VideomailClientOptions, ratio?: number): Dimension;
|
|
3
4
|
export default calculateWidth;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { VideomailClientOptions } from "../../../types/options";
|
|
2
|
-
declare function figureMinHeight(height: number, options: VideomailClientOptions): number;
|
|
2
|
+
declare function figureMinHeight(height: number | undefined, options: VideomailClientOptions): number | undefined;
|
|
3
3
|
export default figureMinHeight;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Dimension } from "../../../types/dimension";
|
|
1
2
|
import { VideomailClientOptions } from "../../../types/options";
|
|
2
|
-
declare function limitHeight(height: number | undefined, options: VideomailClientOptions, calledFrom: string):
|
|
3
|
+
declare function limitHeight(height: number | undefined, options: VideomailClientOptions, calledFrom: string): Dimension;
|
|
3
4
|
export default limitHeight;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Dimension } from "../../../types/dimension";
|
|
1
2
|
import { VideomailClientOptions } from "../../../types/options";
|
|
2
|
-
declare function limitWidth(element: HTMLElement, options: VideomailClientOptions, width?: number):
|
|
3
|
+
declare function limitWidth(element: HTMLElement, options: VideomailClientOptions, width?: number): Dimension;
|
|
3
4
|
export default limitWidth;
|
|
@@ -41,8 +41,8 @@ declare class Container extends Despot {
|
|
|
41
41
|
private unloadChildren;
|
|
42
42
|
private hideMySelf;
|
|
43
43
|
private submitVideomail;
|
|
44
|
-
limitWidth(width?: number):
|
|
45
|
-
limitHeight(height: number):
|
|
44
|
+
limitWidth(width?: number): import("../types/dimension").Dimension | undefined;
|
|
45
|
+
limitHeight(height: number): import("../types/dimension").Dimension;
|
|
46
46
|
private areVisualsHidden;
|
|
47
47
|
hasElement(): boolean;
|
|
48
48
|
getSubmitButton(): HTMLButtonElement | undefined;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Dimension } from "../../types/dimension";
|
|
1
2
|
import { VideomailClientOptions } from "../../types/options";
|
|
2
3
|
import { RecordingStats } from "../../types/RecordingStats";
|
|
3
4
|
import Despot from "../../util/Despot";
|
|
@@ -100,16 +101,16 @@ declare class Recorder extends Despot {
|
|
|
100
101
|
isRecording(): boolean;
|
|
101
102
|
hide(): void;
|
|
102
103
|
isUnloaded(): boolean | undefined;
|
|
103
|
-
getRecorderWidth(responsive: boolean):
|
|
104
|
-
getRecorderHeight(responsive: boolean, useBoundingClientRect?: boolean):
|
|
104
|
+
getRecorderWidth(responsive: boolean): Dimension | undefined;
|
|
105
|
+
getRecorderHeight(responsive: boolean, useBoundingClientRect?: boolean): Dimension;
|
|
105
106
|
private getRatio;
|
|
106
|
-
calculateWidth(responsive: boolean):
|
|
107
|
-
calculateHeight(responsive: boolean):
|
|
107
|
+
calculateWidth(responsive: boolean): Dimension;
|
|
108
|
+
calculateHeight(responsive: boolean): Dimension;
|
|
108
109
|
getRawVisualUserMedia(): HTMLVideoElement | null | undefined;
|
|
109
110
|
isConnected(): boolean;
|
|
110
111
|
isConnecting(): boolean;
|
|
111
|
-
limitWidth(width?: number):
|
|
112
|
-
limitHeight(height: number):
|
|
112
|
+
limitWidth(width?: number): Dimension | undefined;
|
|
113
|
+
limitHeight(height: number): Dimension;
|
|
113
114
|
isUserMediaLoaded(): boolean | undefined;
|
|
114
115
|
}
|
|
115
116
|
export default Recorder;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Dimension } from "../../types/dimension";
|
|
1
2
|
import { VideomailClientOptions } from "../../types/options";
|
|
2
3
|
import Despot from "../../util/Despot";
|
|
3
4
|
import { AudioProcessCB } from "../../util/html/media/AudioRecorder";
|
|
@@ -32,8 +33,8 @@ declare class UserMedia extends Despot {
|
|
|
32
33
|
getVideoHeight(): number | undefined;
|
|
33
34
|
getVideoWidth(): number | undefined;
|
|
34
35
|
hasVideoWidth(): boolean | 0 | undefined;
|
|
35
|
-
getRawWidth(responsive: boolean):
|
|
36
|
-
getRawHeight(responsive: boolean): number;
|
|
36
|
+
getRawWidth(responsive: boolean): Dimension;
|
|
37
|
+
getRawHeight(responsive: boolean): number | undefined;
|
|
37
38
|
getRawVisuals(): HTMLVideoElement | null | undefined;
|
|
38
39
|
pause(): void;
|
|
39
40
|
isPaused(): boolean;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ShowParams } from "../client";
|
|
2
|
+
import { Dimension } from "../types/dimension";
|
|
2
3
|
import { VideomailClientOptions } from "../types/options";
|
|
3
4
|
import Despot from "../util/Despot";
|
|
4
5
|
import VideomailError from "../util/error/VideomailError";
|
|
@@ -52,10 +53,10 @@ declare class Visuals extends Despot {
|
|
|
52
53
|
showReplayOnly(): void;
|
|
53
54
|
isRecorderUnloaded(): boolean | undefined;
|
|
54
55
|
isConnecting(): boolean;
|
|
55
|
-
getRecorderWidth(responsive: boolean):
|
|
56
|
-
getRecorderHeight(responsive: boolean, useBoundingClientRect?: boolean):
|
|
57
|
-
limitWidth(width?: number):
|
|
58
|
-
limitHeight(height: number):
|
|
56
|
+
getRecorderWidth(responsive: boolean): Dimension | undefined;
|
|
57
|
+
getRecorderHeight(responsive: boolean, useBoundingClientRect?: boolean): Dimension;
|
|
58
|
+
limitWidth(width?: number): Dimension | undefined;
|
|
59
|
+
limitHeight(height: number): Dimension;
|
|
59
60
|
getReplay(): Replay;
|
|
60
61
|
getBoundingClientRect(): DOMRect | undefined;
|
|
61
62
|
checkTimer(elapsedTime: number): void;
|