videomail-client 13.3.2 → 13.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.cjs +152 -45
- package/dist/esm/index.js +152 -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 +152 -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.0"
|
|
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,25 @@ 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
|
+
if (heightDimension) this.notifyElement.style.height = `${heightDimension.value}${heightDimension.unit}`;
|
|
5597
5628
|
}
|
|
5598
5629
|
}
|
|
5599
5630
|
show() {
|
|
@@ -5732,7 +5763,7 @@ const notifier = Notifier;
|
|
|
5732
5763
|
function figureMinHeight(height, options) {
|
|
5733
5764
|
let minHeight;
|
|
5734
5765
|
if (options.video.height) {
|
|
5735
|
-
minHeight = Math.min(options.video.height, height);
|
|
5766
|
+
minHeight = height ? Math.min(options.video.height, height) : options.video.height;
|
|
5736
5767
|
if (minHeight < 1) throw error_createError({
|
|
5737
5768
|
message: `Got a min height less than 1 (${minHeight})!`,
|
|
5738
5769
|
options
|
|
@@ -5753,24 +5784,38 @@ function getRatio(options, videoHeight, videoWidth) {
|
|
|
5753
5784
|
}
|
|
5754
5785
|
const dimensions_getRatio = getRatio;
|
|
5755
5786
|
function calculateHeight(responsive, videoWidth, options, target, ratio, element) {
|
|
5787
|
+
const dimension = {
|
|
5788
|
+
unit: "px"
|
|
5789
|
+
};
|
|
5756
5790
|
let width = videoWidth;
|
|
5757
5791
|
if (width < 1) throw error_createError({
|
|
5758
5792
|
message: `Unable to calculate height for target ${target} when width is less than 1 (= ${width}) and responsive mode is set to ${responsive}`,
|
|
5759
5793
|
options
|
|
5760
5794
|
});
|
|
5761
|
-
if (responsive && element)
|
|
5795
|
+
if (responsive && element) {
|
|
5796
|
+
const limitedDimension = dimensions_limitWidth(element, options, width);
|
|
5797
|
+
width = limitedDimension.value;
|
|
5798
|
+
}
|
|
5762
5799
|
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({
|
|
5800
|
+
const height = width ? Math.round(width * chosenRatio) : void 0;
|
|
5801
|
+
if (height && Number.isInteger(height) && height < 1) throw error_createError({
|
|
5765
5802
|
message: "Just calculated a height less than 1 which is wrong.",
|
|
5766
5803
|
options
|
|
5767
5804
|
});
|
|
5768
|
-
|
|
5805
|
+
const minHeight = dimensions_figureMinHeight(height, options);
|
|
5806
|
+
dimension.value = minHeight;
|
|
5807
|
+
return dimension;
|
|
5769
5808
|
}
|
|
5770
5809
|
const dimensions_calculateHeight = calculateHeight;
|
|
5771
5810
|
function calculateWidth(responsive, videoHeight, options, ratio) {
|
|
5811
|
+
const dimension = {
|
|
5812
|
+
unit: "px"
|
|
5813
|
+
};
|
|
5772
5814
|
let height = dimensions_figureMinHeight(videoHeight, options);
|
|
5773
|
-
if (responsive)
|
|
5815
|
+
if (responsive) {
|
|
5816
|
+
const limitedDimension = dimensions_limitHeight(height, options, "calculateWidth");
|
|
5817
|
+
height = limitedDimension.value;
|
|
5818
|
+
}
|
|
5774
5819
|
if (!height || height < 1) throw error_createError({
|
|
5775
5820
|
message: `Height ${height} cannot be smaller than 1 when calculating width.`,
|
|
5776
5821
|
options
|
|
@@ -5781,7 +5826,8 @@ function calculateWidth(responsive, videoHeight, options, ratio) {
|
|
|
5781
5826
|
message: "Calculated width cannot be smaller than 1!",
|
|
5782
5827
|
options
|
|
5783
5828
|
});
|
|
5784
|
-
|
|
5829
|
+
dimension.value = calculatedWidth;
|
|
5830
|
+
return dimension;
|
|
5785
5831
|
}
|
|
5786
5832
|
const dimensions_calculateWidth = calculateWidth;
|
|
5787
5833
|
const CHANNELS = 1;
|
|
@@ -6108,8 +6154,8 @@ class UserMedia extends util_Despot {
|
|
|
6108
6154
|
}
|
|
6109
6155
|
createCanvas() {
|
|
6110
6156
|
const canvas = document.createElement("canvas");
|
|
6111
|
-
const
|
|
6112
|
-
if (
|
|
6157
|
+
const dimension = this.getRawWidth(true);
|
|
6158
|
+
if (dimension.value) canvas.width = dimension.value;
|
|
6113
6159
|
const rawHeight = this.getRawHeight(true);
|
|
6114
6160
|
if (rawHeight) canvas.height = rawHeight;
|
|
6115
6161
|
return canvas;
|
|
@@ -6128,14 +6174,25 @@ class UserMedia extends util_Despot {
|
|
|
6128
6174
|
}
|
|
6129
6175
|
getRawWidth(responsive) {
|
|
6130
6176
|
let rawWidth = this.getVideoWidth();
|
|
6131
|
-
|
|
6132
|
-
|
|
6133
|
-
|
|
6177
|
+
const dimension = {
|
|
6178
|
+
unit: "px"
|
|
6179
|
+
};
|
|
6180
|
+
if (this.options.video.width || this.options.video.height) if (responsive) {
|
|
6181
|
+
const dimension = this.recorder.calculateWidth(responsive);
|
|
6182
|
+
rawWidth = dimension.value;
|
|
6183
|
+
} else rawWidth = this.options.video.width;
|
|
6184
|
+
if (responsive) {
|
|
6185
|
+
const dimension = this.recorder.limitWidth(rawWidth);
|
|
6186
|
+
rawWidth = dimension?.value;
|
|
6187
|
+
}
|
|
6188
|
+
dimension.value = rawWidth;
|
|
6189
|
+
return dimension;
|
|
6134
6190
|
}
|
|
6135
6191
|
getRawHeight(responsive) {
|
|
6136
6192
|
let rawHeight;
|
|
6137
6193
|
if (this.options.video.width || this.options.video.height) {
|
|
6138
|
-
|
|
6194
|
+
const heightDimension = this.recorder.calculateHeight(responsive);
|
|
6195
|
+
rawHeight = heightDimension.value;
|
|
6139
6196
|
if (!rawHeight || rawHeight < 1) throw error_createError({
|
|
6140
6197
|
message: "Bad dimensions",
|
|
6141
6198
|
explanation: "Calculated raw height cannot be less than 1!",
|
|
@@ -6149,7 +6206,10 @@ class UserMedia extends util_Despot {
|
|
|
6149
6206
|
options: this.options
|
|
6150
6207
|
});
|
|
6151
6208
|
}
|
|
6152
|
-
if (responsive)
|
|
6209
|
+
if (responsive) {
|
|
6210
|
+
const heightDimension = this.recorder.limitHeight(rawHeight);
|
|
6211
|
+
rawHeight = heightDimension.value;
|
|
6212
|
+
}
|
|
6153
6213
|
return rawHeight;
|
|
6154
6214
|
}
|
|
6155
6215
|
getRawVisuals() {
|
|
@@ -6368,13 +6428,13 @@ class Recorder extends util_Despot {
|
|
|
6368
6428
|
if (args.mp4) this.replay.setMp4Source(`${args.mp4 + constants.SITE_NAME_LABEL}/${this.options.siteName}/videomail.mp4`, true);
|
|
6369
6429
|
if (args.webm) this.replay.setWebMSource(`${args.webm + constants.SITE_NAME_LABEL}/${this.options.siteName}/videomail.webm`, true);
|
|
6370
6430
|
this.hide();
|
|
6371
|
-
const
|
|
6372
|
-
const
|
|
6431
|
+
const widthDimension = this.getRecorderWidth(true);
|
|
6432
|
+
const heightDimension = this.getRecorderHeight(true);
|
|
6373
6433
|
const duration = args.duration ?? -1;
|
|
6374
6434
|
this.emit("PREVIEW", {
|
|
6375
6435
|
key: this.key,
|
|
6376
|
-
width,
|
|
6377
|
-
height,
|
|
6436
|
+
width: widthDimension?.value,
|
|
6437
|
+
height: heightDimension.value,
|
|
6378
6438
|
hasAudio,
|
|
6379
6439
|
duration
|
|
6380
6440
|
});
|
|
@@ -6555,8 +6615,8 @@ class Recorder extends util_Despot {
|
|
|
6555
6615
|
};
|
|
6556
6616
|
} else if (constraints.video && true !== constraints.video) {
|
|
6557
6617
|
const limitedWidth = this.limitWidth();
|
|
6558
|
-
if (limitedWidth) constraints.video.width = {
|
|
6559
|
-
ideal: limitedWidth
|
|
6618
|
+
if (limitedWidth?.value) constraints.video.width = {
|
|
6619
|
+
ideal: limitedWidth.value
|
|
6560
6620
|
};
|
|
6561
6621
|
}
|
|
6562
6622
|
if (this.options.video.height && constraints.video && true !== constraints.video) {
|
|
@@ -6970,13 +7030,17 @@ class Recorder extends util_Despot {
|
|
|
6970
7030
|
}
|
|
6971
7031
|
correctDimensions() {
|
|
6972
7032
|
if (!this.recorderElement) return;
|
|
6973
|
-
|
|
6974
|
-
|
|
6975
|
-
|
|
6976
|
-
|
|
6977
|
-
|
|
6978
|
-
|
|
6979
|
-
|
|
7033
|
+
const widthDimension = dimensions_useFullWidth(this.options.video.mobileBreakPoint);
|
|
7034
|
+
if (this.options.video.stretch || widthDimension) this.recorderElement.style.width = "100%";
|
|
7035
|
+
else {
|
|
7036
|
+
if (this.options.video.width) {
|
|
7037
|
+
const recorderWidth = this.getRecorderWidth(true);
|
|
7038
|
+
if (recorderWidth?.value) this.recorderElement.width = recorderWidth.value;
|
|
7039
|
+
}
|
|
7040
|
+
if (this.options.video.height) {
|
|
7041
|
+
const recorderHeight = this.getRecorderHeight(true);
|
|
7042
|
+
if (recorderHeight.value) this.recorderElement.height = recorderHeight.value;
|
|
7043
|
+
}
|
|
6980
7044
|
}
|
|
6981
7045
|
}
|
|
6982
7046
|
switchFacingMode() {
|
|
@@ -7024,6 +7088,9 @@ class Recorder extends util_Despot {
|
|
|
7024
7088
|
this.on("SWITCH_FACING_MODE", ()=>{
|
|
7025
7089
|
this.switchFacingMode();
|
|
7026
7090
|
});
|
|
7091
|
+
this.on("WINDOW_RESIZE", ()=>{
|
|
7092
|
+
this.correctDimensions();
|
|
7093
|
+
});
|
|
7027
7094
|
}
|
|
7028
7095
|
buildElement() {
|
|
7029
7096
|
this.recorderElement = document.createElement("video");
|
|
@@ -7041,7 +7108,6 @@ class Recorder extends util_Despot {
|
|
|
7041
7108
|
this.recorderElement.style.transform = "rotateY(180deg)";
|
|
7042
7109
|
this.recorderElement.style["-webkit-transform"] = "rotateY(180deg)";
|
|
7043
7110
|
this.recorderElement.style["-moz-transform"] = "rotateY(180deg)";
|
|
7044
|
-
if (this.options.video.stretch) this.recorderElement.style.width = "100%";
|
|
7045
7111
|
this.userMedia ??= new visuals_userMedia(this, this.options);
|
|
7046
7112
|
this.show();
|
|
7047
7113
|
if (this.built) {
|
|
@@ -7073,13 +7139,36 @@ class Recorder extends util_Despot {
|
|
|
7073
7139
|
getRecorderWidth(responsive) {
|
|
7074
7140
|
if (this.userMedia?.hasVideoWidth()) return this.userMedia.getRawWidth(responsive);
|
|
7075
7141
|
if (responsive && this.options.video.width) return this.limitWidth(this.options.video.width);
|
|
7076
|
-
|
|
7142
|
+
const dimension = {
|
|
7143
|
+
unit: "px",
|
|
7144
|
+
value: this.options.video.width
|
|
7145
|
+
};
|
|
7146
|
+
return dimension;
|
|
7077
7147
|
}
|
|
7078
7148
|
getRecorderHeight(responsive, useBoundingClientRect) {
|
|
7079
|
-
if (this.recorderElement && useBoundingClientRect)
|
|
7080
|
-
|
|
7149
|
+
if (this.recorderElement && useBoundingClientRect) {
|
|
7150
|
+
const height = this.recorderElement.getBoundingClientRect().height;
|
|
7151
|
+
const dimension = {
|
|
7152
|
+
unit: "px",
|
|
7153
|
+
value: height
|
|
7154
|
+
};
|
|
7155
|
+
return dimension;
|
|
7156
|
+
}
|
|
7157
|
+
if (this.userMedia) {
|
|
7158
|
+
const height = this.userMedia.getRawHeight(responsive);
|
|
7159
|
+
const dimension = {
|
|
7160
|
+
unit: "px",
|
|
7161
|
+
value: height
|
|
7162
|
+
};
|
|
7163
|
+
return dimension;
|
|
7164
|
+
}
|
|
7081
7165
|
if (responsive && this.options.video.height) return this.calculateHeight(responsive);
|
|
7082
|
-
|
|
7166
|
+
const height = this.options.video.height;
|
|
7167
|
+
const dimension = {
|
|
7168
|
+
unit: "px",
|
|
7169
|
+
value: height
|
|
7170
|
+
};
|
|
7171
|
+
return dimension;
|
|
7083
7172
|
}
|
|
7084
7173
|
getRatio() {
|
|
7085
7174
|
let ratio;
|
|
@@ -7430,13 +7519,22 @@ class Visuals extends util_Despot {
|
|
|
7430
7519
|
this.on("ERROR", ()=>{
|
|
7431
7520
|
if (util_getBrowser(this.options).isMobile()) this.removeDimensions();
|
|
7432
7521
|
});
|
|
7522
|
+
this.on("WINDOW_RESIZE", ()=>{
|
|
7523
|
+
this.correctDimensions();
|
|
7524
|
+
});
|
|
7433
7525
|
}
|
|
7434
7526
|
}
|
|
7435
7527
|
correctDimensions() {
|
|
7436
7528
|
if (this.options.video.stretch) this.removeDimensions();
|
|
7437
7529
|
else if (this.visualsElement) {
|
|
7438
|
-
|
|
7439
|
-
|
|
7530
|
+
let heightDimension;
|
|
7531
|
+
let widthDimension = dimensions_useFullWidth(this.options.video.mobileBreakPoint);
|
|
7532
|
+
if (!widthDimension) {
|
|
7533
|
+
widthDimension = this.getRecorderWidth(true);
|
|
7534
|
+
heightDimension = this.getRecorderHeight(true);
|
|
7535
|
+
}
|
|
7536
|
+
if (widthDimension) this.visualsElement.style.width = `${widthDimension.value}${widthDimension.unit}`;
|
|
7537
|
+
if (heightDimension) this.visualsElement.style.height = `${heightDimension.value}${heightDimension.unit}`;
|
|
7440
7538
|
}
|
|
7441
7539
|
}
|
|
7442
7540
|
removeDimensions() {
|
|
@@ -7744,6 +7842,9 @@ class Container extends util_Despot {
|
|
|
7744
7842
|
}
|
|
7745
7843
|
initEvents(playerOnly = false) {
|
|
7746
7844
|
this.options.logger.debug(`Container: initEvents (playerOnly = ${playerOnly})`);
|
|
7845
|
+
window.addEventListener("resize", ()=>{
|
|
7846
|
+
this.emit("WINDOW_RESIZE");
|
|
7847
|
+
});
|
|
7747
7848
|
if (this.options.enableAutoUnload) window.addEventListener("beforeunload", (e)=>{
|
|
7748
7849
|
this.unload({
|
|
7749
7850
|
e
|
|
@@ -7781,6 +7882,9 @@ class Container extends util_Despot {
|
|
|
7781
7882
|
const browser = util_getBrowser(this.options);
|
|
7782
7883
|
if (browser.isMobile()) this.removeDimensions();
|
|
7783
7884
|
});
|
|
7885
|
+
this.on("WINDOW_RESIZE", ()=>{
|
|
7886
|
+
this.correctDimensions();
|
|
7887
|
+
});
|
|
7784
7888
|
if (!playerOnly) this.on("LOADED_META_DATA", ()=>{
|
|
7785
7889
|
this.correctDimensions();
|
|
7786
7890
|
});
|
|
@@ -7788,8 +7892,9 @@ class Container extends util_Despot {
|
|
|
7788
7892
|
correctDimensions() {
|
|
7789
7893
|
if (this.options.video.stretch) this.removeDimensions();
|
|
7790
7894
|
else if (this.containerElement) {
|
|
7791
|
-
|
|
7792
|
-
if (
|
|
7895
|
+
let dimension = dimensions_useFullWidth(this.options.video.mobileBreakPoint);
|
|
7896
|
+
if (!dimension) dimension = this.visuals.getRecorderWidth(true);
|
|
7897
|
+
if (dimension?.value) this.containerElement.style.width = `${dimension.value}${dimension.unit}`;
|
|
7793
7898
|
}
|
|
7794
7899
|
}
|
|
7795
7900
|
removeDimensions() {
|
|
@@ -7813,8 +7918,10 @@ class Container extends util_Despot {
|
|
|
7813
7918
|
if (!videomailFormData) throw new Error("No videomail form data defined");
|
|
7814
7919
|
if (method === FormMethod.POST) {
|
|
7815
7920
|
videomailFormData.recordingStats = this.visuals.getRecordingStats();
|
|
7816
|
-
|
|
7817
|
-
|
|
7921
|
+
const widthDimension = this.visuals.getRecorderWidth(true);
|
|
7922
|
+
const heightDimension = this.visuals.getRecorderHeight(true);
|
|
7923
|
+
videomailFormData.width = widthDimension?.value;
|
|
7924
|
+
videomailFormData.height = heightDimension.value;
|
|
7818
7925
|
return await this.resource.post(videomailFormData);
|
|
7819
7926
|
}
|
|
7820
7927
|
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;
|