videomail-client 15.7.17 → 15.7.18
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
CHANGED
|
@@ -10972,7 +10972,7 @@ var __webpack_exports__ = {};
|
|
|
10972
10972
|
var client = __webpack_require__("Q");
|
|
10973
10973
|
var client_default = /*#__PURE__*/ __webpack_require__.n(client);
|
|
10974
10974
|
var package_namespaceObject = {
|
|
10975
|
-
rE: "15.7.
|
|
10975
|
+
rE: "15.7.18"
|
|
10976
10976
|
};
|
|
10977
10977
|
function isAudioEnabled(options) {
|
|
10978
10978
|
return Boolean(options.audio.enabled);
|
|
@@ -14783,18 +14783,18 @@ var __webpack_exports__ = {};
|
|
|
14783
14783
|
if (showParams) this.options.logger.debug(`${this.name} emits ${eventName} with ${util_pretty(params)}`);
|
|
14784
14784
|
else this.options.logger.debug(`${this.name} emits ${eventName}`);
|
|
14785
14785
|
try {
|
|
14786
|
-
|
|
14786
|
+
this.emitter.emit(eventName, ...params);
|
|
14787
14787
|
} catch (exc) {
|
|
14788
|
-
if (exc instanceof error_VideomailError)
|
|
14788
|
+
if (exc instanceof error_VideomailError) this.emitter.emit("ERROR", {
|
|
14789
14789
|
err: exc
|
|
14790
14790
|
});
|
|
14791
|
-
else
|
|
14791
|
+
else this.emitter.emit("ERROR", {
|
|
14792
14792
|
exc
|
|
14793
14793
|
});
|
|
14794
14794
|
}
|
|
14795
14795
|
}
|
|
14796
14796
|
on(eventName, callback) {
|
|
14797
|
-
return
|
|
14797
|
+
return this.emitter.on(eventName, callback);
|
|
14798
14798
|
}
|
|
14799
14799
|
once(eventName, listener) {
|
|
14800
14800
|
const callback = (...params)=>{
|
|
@@ -14804,23 +14804,30 @@ var __webpack_exports__ = {};
|
|
|
14804
14804
|
const unbind = this.on(eventName, callback);
|
|
14805
14805
|
return unbind;
|
|
14806
14806
|
}
|
|
14807
|
-
|
|
14808
|
-
return
|
|
14807
|
+
getListeners(eventName) {
|
|
14808
|
+
return this.emitter.events[eventName];
|
|
14809
14809
|
}
|
|
14810
|
-
|
|
14811
|
-
delete
|
|
14810
|
+
removeListener(eventName) {
|
|
14811
|
+
delete this.emitter.events[eventName];
|
|
14812
14812
|
}
|
|
14813
|
-
|
|
14814
|
-
|
|
14813
|
+
removeAllListeners() {
|
|
14814
|
+
this.emitter.events = {};
|
|
14815
14815
|
}
|
|
14816
14816
|
constructor(name, options){
|
|
14817
14817
|
Despot_define_property(this, "name", void 0);
|
|
14818
|
+
Despot_define_property(this, "emitter", void 0);
|
|
14818
14819
|
Despot_define_property(this, "options", void 0);
|
|
14819
14820
|
this.name = name;
|
|
14820
14821
|
this.options = options;
|
|
14822
|
+
let emitter = Despot.emitters.get(options);
|
|
14823
|
+
if (!emitter) {
|
|
14824
|
+
emitter = createNanoEvents();
|
|
14825
|
+
Despot.emitters.set(options, emitter);
|
|
14826
|
+
}
|
|
14827
|
+
this.emitter = emitter;
|
|
14821
14828
|
}
|
|
14822
14829
|
}
|
|
14823
|
-
Despot_define_property(Despot, "
|
|
14830
|
+
Despot_define_property(Despot, "emitters", new WeakMap());
|
|
14824
14831
|
const util_Despot = Despot;
|
|
14825
14832
|
function getValidity(element) {
|
|
14826
14833
|
const validity = "validity" in element ? element.validity : void 0;
|
|
@@ -14931,27 +14938,33 @@ var __webpack_exports__ = {};
|
|
|
14931
14938
|
this.options.logger.debug("Form: loadVideomail()");
|
|
14932
14939
|
for (const formControl of this.formElement.elements){
|
|
14933
14940
|
const name = formControl.getAttribute("name");
|
|
14934
|
-
if (name) {
|
|
14941
|
+
if (name && this.isRegisteredFormField(formControl)) {
|
|
14935
14942
|
let value = videomail[name];
|
|
14936
14943
|
const tagName = formControl.tagName;
|
|
14937
14944
|
if (this.options.callbacks.adjustFormValueBeforePopulating) value = this.options.callbacks.adjustFormValueBeforePopulating(name, value, videomail);
|
|
14938
|
-
switch(tagName){
|
|
14945
|
+
if (null != value) switch(tagName){
|
|
14939
14946
|
case "INPUT":
|
|
14940
14947
|
{
|
|
14941
14948
|
const inputControl = formControl;
|
|
14942
14949
|
if (Array.isArray(value)) inputControl.value = value.join(", ");
|
|
14943
|
-
else inputControl.value = value;
|
|
14950
|
+
else inputControl.value = String(value);
|
|
14944
14951
|
break;
|
|
14945
14952
|
}
|
|
14946
14953
|
case "TEXTAREA":
|
|
14947
14954
|
{
|
|
14948
14955
|
const textArea = formControl;
|
|
14949
|
-
textArea.value = value;
|
|
14956
|
+
textArea.value = String(value);
|
|
14957
|
+
break;
|
|
14958
|
+
}
|
|
14959
|
+
case "SELECT":
|
|
14960
|
+
{
|
|
14961
|
+
const select = formControl;
|
|
14962
|
+
select.value = String(value);
|
|
14950
14963
|
break;
|
|
14951
14964
|
}
|
|
14952
14965
|
default:
|
|
14953
14966
|
throw error_createError({
|
|
14954
|
-
message: `Unsupported form control tag name
|
|
14967
|
+
message: `Unsupported form control tag name ${tagName} found`,
|
|
14955
14968
|
options: this.options
|
|
14956
14969
|
});
|
|
14957
14970
|
}
|
|
@@ -15000,8 +15013,8 @@ var __webpack_exports__ = {};
|
|
|
15000
15013
|
for(let i = 0, len = inputElements.length; i < len; i++){
|
|
15001
15014
|
const inputElement = inputElements[i];
|
|
15002
15015
|
const type = null == inputElement ? void 0 : inputElement.getAttribute("type");
|
|
15003
|
-
if ("radio" === type ||
|
|
15004
|
-
else null == inputElement || inputElement.addEventListener("input", this.
|
|
15016
|
+
if ("radio" === type || (null == inputElement ? void 0 : inputElement.tagName) === "SELECT") null == inputElement || inputElement.addEventListener("change", this.validate);
|
|
15017
|
+
else null == inputElement || inputElement.addEventListener("input", this.validate);
|
|
15005
15018
|
}
|
|
15006
15019
|
}
|
|
15007
15020
|
this.on("PREVIEW", (params)=>{
|
|
@@ -15046,8 +15059,8 @@ var __webpack_exports__ = {};
|
|
|
15046
15059
|
const inputElements = this.getRegisteredFormElements();
|
|
15047
15060
|
for (const inputElement of inputElements){
|
|
15048
15061
|
const type = inputElement.getAttribute("type");
|
|
15049
|
-
if ("radio" === type || "
|
|
15050
|
-
else inputElement.removeEventListener("input", this.
|
|
15062
|
+
if ("radio" === type || "SELECT" === inputElement.tagName) inputElement.removeEventListener("change", this.validate);
|
|
15063
|
+
else inputElement.removeEventListener("input", this.validate);
|
|
15051
15064
|
}
|
|
15052
15065
|
}
|
|
15053
15066
|
hideSubmitButton() {
|
|
@@ -15057,7 +15070,7 @@ var __webpack_exports__ = {};
|
|
|
15057
15070
|
unload() {
|
|
15058
15071
|
this.options.logger.debug("Form: unload()");
|
|
15059
15072
|
this.removeAllInputListeners();
|
|
15060
|
-
|
|
15073
|
+
this.removeAllListeners();
|
|
15061
15074
|
this.stopListeningToSubmitEvents();
|
|
15062
15075
|
this.resetForm();
|
|
15063
15076
|
}
|
|
@@ -15067,7 +15080,7 @@ var __webpack_exports__ = {};
|
|
|
15067
15080
|
const inputElements = this.getRegisteredFormElements();
|
|
15068
15081
|
for (const inputElement of inputElements){
|
|
15069
15082
|
const type = inputElement.getAttribute("type");
|
|
15070
|
-
if ((null == type ? void 0 : type.toLowerCase()) === "hidden") inputElement.
|
|
15083
|
+
if ((null == type ? void 0 : type.toLowerCase()) === "hidden") inputElement.value = "";
|
|
15071
15084
|
}
|
|
15072
15085
|
}
|
|
15073
15086
|
startListeningToSubmitEvents() {
|
|
@@ -15120,7 +15133,9 @@ var __webpack_exports__ = {};
|
|
|
15120
15133
|
html_showElement(this.formElement);
|
|
15121
15134
|
}
|
|
15122
15135
|
constructor(container, formElement, options){
|
|
15123
|
-
super("Form", options), form_define_property(this, "container", void 0), form_define_property(this, "formElement", void 0), form_define_property(this, "
|
|
15136
|
+
super("Form", options), form_define_property(this, "container", void 0), form_define_property(this, "formElement", void 0), form_define_property(this, "validate", (event)=>{
|
|
15137
|
+
this.container.validate(event);
|
|
15138
|
+
}), form_define_property(this, "keyInput", void 0), form_define_property(this, "FORM_FIELDS", {});
|
|
15124
15139
|
this.container = container;
|
|
15125
15140
|
this.formElement = formElement;
|
|
15126
15141
|
this.FORM_FIELDS = {
|
|
@@ -18063,7 +18078,7 @@ var __webpack_exports__ = {};
|
|
|
18063
18078
|
if (this.built) {
|
|
18064
18079
|
this.reset();
|
|
18065
18080
|
this.options.logger.debug("Buttons: unload()");
|
|
18066
|
-
|
|
18081
|
+
this.removeAllListeners();
|
|
18067
18082
|
this.hide();
|
|
18068
18083
|
this.built = false;
|
|
18069
18084
|
}
|
|
@@ -18113,7 +18128,8 @@ var __webpack_exports__ = {};
|
|
|
18113
18128
|
fire(cb) {
|
|
18114
18129
|
this.unload();
|
|
18115
18130
|
this.hide();
|
|
18116
|
-
setTimeout(
|
|
18131
|
+
this.fireTimeoutId = window.setTimeout(()=>{
|
|
18132
|
+
this.fireTimeoutId = void 0;
|
|
18117
18133
|
cb();
|
|
18118
18134
|
}, 0);
|
|
18119
18135
|
}
|
|
@@ -18123,15 +18139,16 @@ var __webpack_exports__ = {};
|
|
|
18123
18139
|
if (void 0 !== this.countdown) {
|
|
18124
18140
|
this.countdown--;
|
|
18125
18141
|
if (this.countdown < 1) this.fire(cb);
|
|
18126
|
-
else if (this.countdownElement) this.countdownElement.
|
|
18142
|
+
else if (this.countdownElement) this.countdownElement.textContent = this.countdown.toString();
|
|
18127
18143
|
}
|
|
18128
18144
|
}
|
|
18129
18145
|
}
|
|
18130
18146
|
start(cb) {
|
|
18131
18147
|
if (!this.countdownElement) throw new Error("Unable to start countdown without an element");
|
|
18132
18148
|
if ("number" != typeof this.options.video.countdown) throw new TypeError(`The defined countdown is not a valid number: ${this.options.video.countdown}`);
|
|
18149
|
+
this.unload();
|
|
18133
18150
|
this.countdown = this.options.video.countdown;
|
|
18134
|
-
this.countdownElement.
|
|
18151
|
+
this.countdownElement.textContent = this.countdown.toString();
|
|
18135
18152
|
this.show();
|
|
18136
18153
|
this.intervalId = window.setInterval(this.countBackward.bind(this, cb), 950);
|
|
18137
18154
|
}
|
|
@@ -18156,12 +18173,14 @@ var __webpack_exports__ = {};
|
|
|
18156
18173
|
html_showElement(this.countdownElement);
|
|
18157
18174
|
}
|
|
18158
18175
|
isCountingDown() {
|
|
18159
|
-
return
|
|
18176
|
+
return void 0 !== this.intervalId;
|
|
18160
18177
|
}
|
|
18161
18178
|
unload() {
|
|
18162
|
-
clearInterval(this.intervalId);
|
|
18179
|
+
if (void 0 !== this.intervalId) window.clearInterval(this.intervalId);
|
|
18180
|
+
if (void 0 !== this.fireTimeoutId) window.clearTimeout(this.fireTimeoutId);
|
|
18163
18181
|
this.paused = false;
|
|
18164
18182
|
this.intervalId = void 0;
|
|
18183
|
+
this.fireTimeoutId = void 0;
|
|
18165
18184
|
}
|
|
18166
18185
|
hide() {
|
|
18167
18186
|
html_hideElement(this.countdownElement);
|
|
@@ -18172,6 +18191,7 @@ var __webpack_exports__ = {};
|
|
|
18172
18191
|
countdown_define_property(this, "options", void 0);
|
|
18173
18192
|
countdown_define_property(this, "countdownElement", void 0);
|
|
18174
18193
|
countdown_define_property(this, "intervalId", void 0);
|
|
18194
|
+
countdown_define_property(this, "fireTimeoutId", void 0);
|
|
18175
18195
|
countdown_define_property(this, "countdown", void 0);
|
|
18176
18196
|
countdown_define_property(this, "paused", false);
|
|
18177
18197
|
this.visuals = visuals;
|
|
@@ -19291,7 +19311,7 @@ var __webpack_exports__ = {};
|
|
|
19291
19311
|
}
|
|
19292
19312
|
audioRecord(audioCallback) {
|
|
19293
19313
|
var _this_audioRecorder;
|
|
19294
|
-
|
|
19314
|
+
this.removeListener("SENDING_FIRST_FRAME");
|
|
19295
19315
|
null == (_this_audioRecorder = this.audioRecorder) || _this_audioRecorder.record(audioCallback);
|
|
19296
19316
|
}
|
|
19297
19317
|
init(localMediaStream, videoCallback, audioCallback, endedEarlyCallback, switchingFacingMode) {
|
|
@@ -19308,7 +19328,7 @@ var __webpack_exports__ = {};
|
|
|
19308
19328
|
var _this_rawVisualUserMedia, _this_rawVisualUserMedia1;
|
|
19309
19329
|
this.options.logger.debug("UserMedia: unloadAllEventListeners()");
|
|
19310
19330
|
this.unloadRemainingEventListeners();
|
|
19311
|
-
|
|
19331
|
+
this.removeListener("SENDING_FIRST_FRAME");
|
|
19312
19332
|
null == (_this_rawVisualUserMedia = this.rawVisualUserMedia) || _this_rawVisualUserMedia.removeEventListener("play", onPlay);
|
|
19313
19333
|
null == (_this_rawVisualUserMedia1 = this.rawVisualUserMedia) || _this_rawVisualUserMedia1.removeEventListener("loadedmetadata", onLoadedMetaData);
|
|
19314
19334
|
};
|
|
@@ -19978,7 +19998,7 @@ var __webpack_exports__ = {};
|
|
|
19978
19998
|
this.clearUserMediaTimeout();
|
|
19979
19999
|
const characteristics = null == (_this_userMedia = this.userMedia) ? void 0 : _this_userMedia.getCharacteristics();
|
|
19980
20000
|
this.options.logger.debug(`Recorder: userMediaErrorCallback(), name: ${err.name}, message: ${err.message} and Webcam characteristics: ${characteristics ? util_pretty(characteristics) : "none"}`);
|
|
19981
|
-
const errorListeners =
|
|
20001
|
+
const errorListeners = this.getListeners("ERROR");
|
|
19982
20002
|
if (null == errorListeners ? void 0 : errorListeners.length) {
|
|
19983
20003
|
if (err.name !== error_VideomailError.MEDIA_DEVICE_NOT_SUPPORTED) {
|
|
19984
20004
|
const videomailError = error_createError({
|
|
@@ -20081,7 +20101,7 @@ var __webpack_exports__ = {};
|
|
|
20081
20101
|
this.clearUserMediaTimeout();
|
|
20082
20102
|
this.options.logger.debug("Recorder: failed to load genuine user media");
|
|
20083
20103
|
this.userMediaLoading = false;
|
|
20084
|
-
const errorListeners =
|
|
20104
|
+
const errorListeners = this.getListeners("ERROR");
|
|
20085
20105
|
if (null == errorListeners ? void 0 : errorListeners.length) this.emit("ERROR", {
|
|
20086
20106
|
exc
|
|
20087
20107
|
});
|
|
@@ -20725,12 +20745,12 @@ var __webpack_exports__ = {};
|
|
|
20725
20745
|
heightValue = this.videomail.height;
|
|
20726
20746
|
if (widthValue && heightValue) ratio = heightValue / widthValue;
|
|
20727
20747
|
}
|
|
20728
|
-
if (!widthValue) {
|
|
20748
|
+
if (!widthValue && (videoHeight > 0 || this.options.video.height)) {
|
|
20729
20749
|
const newWidthDimensions = dimensions_calculateWidth(responsive, this.options, videoHeight, ratio);
|
|
20730
20750
|
const newWidth = newWidthDimensions.value;
|
|
20731
20751
|
widthValue = newWidth;
|
|
20732
20752
|
}
|
|
20733
|
-
if (!heightValue) {
|
|
20753
|
+
if (!heightValue && (videoWidth > 0 || this.options.video.width)) {
|
|
20734
20754
|
let element = this.visuals.getElement();
|
|
20735
20755
|
if (!element) element = document.body;
|
|
20736
20756
|
const newDimensions = dimensions_calculateHeight(responsive, videoWidth, this.options, ratio, element);
|
|
@@ -20742,14 +20762,15 @@ var __webpack_exports__ = {};
|
|
|
20742
20762
|
else this.replayElement.style.height = "auto";
|
|
20743
20763
|
}
|
|
20744
20764
|
setVideomail(newVideomail, playerOnly = false) {
|
|
20745
|
-
var _this_videomail_recordingStats;
|
|
20765
|
+
var _this_replayElement, _this_videomail_recordingStats;
|
|
20746
20766
|
this.videomail = newVideomail;
|
|
20767
|
+
null == (_this_replayElement = this.replayElement) || _this_replayElement.setAttribute("controls", "controls");
|
|
20747
20768
|
if (this.videomail.mp4) this.setMp4Source(this.videomail.mp4);
|
|
20748
20769
|
if (this.videomail.webm) this.setWebMSource(this.videomail.webm);
|
|
20749
20770
|
if (this.videomail.vtt) this.setTrackSource(this.videomail.vtt);
|
|
20750
20771
|
if (this.videomail.poster) {
|
|
20751
|
-
var
|
|
20752
|
-
null == (
|
|
20772
|
+
var _this_replayElement1;
|
|
20773
|
+
null == (_this_replayElement1 = this.replayElement) || _this_replayElement1.setAttribute("poster", this.videomail.poster);
|
|
20753
20774
|
}
|
|
20754
20775
|
this.copyAttributes(this.videomail);
|
|
20755
20776
|
const sampleRate = null == (_this_videomail_recordingStats = this.videomail.recordingStats) ? void 0 : _this_videomail_recordingStats.sampleRate;
|
|
@@ -20770,7 +20791,7 @@ var __webpack_exports__ = {};
|
|
|
20770
20791
|
} else html_showElement(this.replayElement);
|
|
20771
20792
|
if (playerOnly) html_showElement(this.replayElement.parentElement);
|
|
20772
20793
|
else this.visuals.show();
|
|
20773
|
-
if (hasAudio) this.replayElement.
|
|
20794
|
+
if (hasAudio) this.replayElement.volume = 1;
|
|
20774
20795
|
else if (!isAudioEnabled(this.options)) this.replayElement.setAttribute("muted", "true");
|
|
20775
20796
|
this.replayElement.load();
|
|
20776
20797
|
if (this.videomail) this.replayElement.addEventListener("canplaythrough", ()=>{
|
|
@@ -20841,7 +20862,7 @@ var __webpack_exports__ = {};
|
|
|
20841
20862
|
}
|
|
20842
20863
|
unload(params) {
|
|
20843
20864
|
this.options.logger.debug("Replay: unload()");
|
|
20844
|
-
|
|
20865
|
+
this.removeAllListeners();
|
|
20845
20866
|
if (null == params ? void 0 : params.startingOver) this.hide();
|
|
20846
20867
|
else {
|
|
20847
20868
|
var _this_replayElement;
|
|
@@ -21515,7 +21536,7 @@ var __webpack_exports__ = {};
|
|
|
21515
21536
|
exc
|
|
21516
21537
|
});
|
|
21517
21538
|
} finally{
|
|
21518
|
-
|
|
21539
|
+
this.removeAllListeners();
|
|
21519
21540
|
this.built = this.submitted = false;
|
|
21520
21541
|
}
|
|
21521
21542
|
}
|
package/dist/esm/index.js
CHANGED
|
@@ -3620,7 +3620,7 @@ const constants = {
|
|
|
3620
3620
|
}
|
|
3621
3621
|
};
|
|
3622
3622
|
var package_namespaceObject = {
|
|
3623
|
-
rE: "15.7.
|
|
3623
|
+
rE: "15.7.18"
|
|
3624
3624
|
};
|
|
3625
3625
|
function isAudioEnabled(options) {
|
|
3626
3626
|
return Boolean(options.audio.enabled);
|
|
@@ -4053,18 +4053,18 @@ class Despot {
|
|
|
4053
4053
|
if (showParams) this.options.logger.debug(`${this.name} emits ${eventName} with ${util_pretty(params)}`);
|
|
4054
4054
|
else this.options.logger.debug(`${this.name} emits ${eventName}`);
|
|
4055
4055
|
try {
|
|
4056
|
-
|
|
4056
|
+
this.emitter.emit(eventName, ...params);
|
|
4057
4057
|
} catch (exc) {
|
|
4058
|
-
if (exc instanceof error_VideomailError)
|
|
4058
|
+
if (exc instanceof error_VideomailError) this.emitter.emit("ERROR", {
|
|
4059
4059
|
err: exc
|
|
4060
4060
|
});
|
|
4061
|
-
else
|
|
4061
|
+
else this.emitter.emit("ERROR", {
|
|
4062
4062
|
exc
|
|
4063
4063
|
});
|
|
4064
4064
|
}
|
|
4065
4065
|
}
|
|
4066
4066
|
on(eventName, callback) {
|
|
4067
|
-
return
|
|
4067
|
+
return this.emitter.on(eventName, callback);
|
|
4068
4068
|
}
|
|
4069
4069
|
once(eventName, listener) {
|
|
4070
4070
|
const callback = (...params)=>{
|
|
@@ -4074,23 +4074,30 @@ class Despot {
|
|
|
4074
4074
|
const unbind = this.on(eventName, callback);
|
|
4075
4075
|
return unbind;
|
|
4076
4076
|
}
|
|
4077
|
-
|
|
4078
|
-
return
|
|
4077
|
+
getListeners(eventName) {
|
|
4078
|
+
return this.emitter.events[eventName];
|
|
4079
4079
|
}
|
|
4080
|
-
|
|
4081
|
-
delete
|
|
4080
|
+
removeListener(eventName) {
|
|
4081
|
+
delete this.emitter.events[eventName];
|
|
4082
4082
|
}
|
|
4083
|
-
|
|
4084
|
-
|
|
4083
|
+
removeAllListeners() {
|
|
4084
|
+
this.emitter.events = {};
|
|
4085
4085
|
}
|
|
4086
4086
|
constructor(name, options){
|
|
4087
4087
|
Despot_define_property(this, "name", void 0);
|
|
4088
|
+
Despot_define_property(this, "emitter", void 0);
|
|
4088
4089
|
Despot_define_property(this, "options", void 0);
|
|
4089
4090
|
this.name = name;
|
|
4090
4091
|
this.options = options;
|
|
4092
|
+
let emitter = Despot.emitters.get(options);
|
|
4093
|
+
if (!emitter) {
|
|
4094
|
+
emitter = createNanoEvents();
|
|
4095
|
+
Despot.emitters.set(options, emitter);
|
|
4096
|
+
}
|
|
4097
|
+
this.emitter = emitter;
|
|
4091
4098
|
}
|
|
4092
4099
|
}
|
|
4093
|
-
Despot_define_property(Despot, "
|
|
4100
|
+
Despot_define_property(Despot, "emitters", new WeakMap());
|
|
4094
4101
|
const util_Despot = Despot;
|
|
4095
4102
|
function getValidity(element) {
|
|
4096
4103
|
const validity = "validity" in element ? element.validity : void 0;
|
|
@@ -4175,27 +4182,33 @@ class Form extends util_Despot {
|
|
|
4175
4182
|
this.options.logger.debug("Form: loadVideomail()");
|
|
4176
4183
|
for (const formControl of this.formElement.elements){
|
|
4177
4184
|
const name = formControl.getAttribute("name");
|
|
4178
|
-
if (name) {
|
|
4185
|
+
if (name && this.isRegisteredFormField(formControl)) {
|
|
4179
4186
|
let value = videomail[name];
|
|
4180
4187
|
const tagName = formControl.tagName;
|
|
4181
4188
|
if (this.options.callbacks.adjustFormValueBeforePopulating) value = this.options.callbacks.adjustFormValueBeforePopulating(name, value, videomail);
|
|
4182
|
-
switch(tagName){
|
|
4189
|
+
if (null != value) switch(tagName){
|
|
4183
4190
|
case "INPUT":
|
|
4184
4191
|
{
|
|
4185
4192
|
const inputControl = formControl;
|
|
4186
4193
|
if (Array.isArray(value)) inputControl.value = value.join(", ");
|
|
4187
|
-
else inputControl.value = value;
|
|
4194
|
+
else inputControl.value = String(value);
|
|
4188
4195
|
break;
|
|
4189
4196
|
}
|
|
4190
4197
|
case "TEXTAREA":
|
|
4191
4198
|
{
|
|
4192
4199
|
const textArea = formControl;
|
|
4193
|
-
textArea.value = value;
|
|
4200
|
+
textArea.value = String(value);
|
|
4201
|
+
break;
|
|
4202
|
+
}
|
|
4203
|
+
case "SELECT":
|
|
4204
|
+
{
|
|
4205
|
+
const select = formControl;
|
|
4206
|
+
select.value = String(value);
|
|
4194
4207
|
break;
|
|
4195
4208
|
}
|
|
4196
4209
|
default:
|
|
4197
4210
|
throw error_createError({
|
|
4198
|
-
message: `Unsupported form control tag name
|
|
4211
|
+
message: `Unsupported form control tag name ${tagName} found`,
|
|
4199
4212
|
options: this.options
|
|
4200
4213
|
});
|
|
4201
4214
|
}
|
|
@@ -4244,8 +4257,8 @@ class Form extends util_Despot {
|
|
|
4244
4257
|
for(let i = 0, len = inputElements.length; i < len; i++){
|
|
4245
4258
|
const inputElement = inputElements[i];
|
|
4246
4259
|
const type = inputElement?.getAttribute("type");
|
|
4247
|
-
if ("radio" === type ||
|
|
4248
|
-
else inputElement?.addEventListener("input", this.
|
|
4260
|
+
if ("radio" === type || inputElement?.tagName === "SELECT") inputElement?.addEventListener("change", this.validate);
|
|
4261
|
+
else inputElement?.addEventListener("input", this.validate);
|
|
4249
4262
|
}
|
|
4250
4263
|
}
|
|
4251
4264
|
this.on("PREVIEW", (params)=>{
|
|
@@ -4288,8 +4301,8 @@ class Form extends util_Despot {
|
|
|
4288
4301
|
const inputElements = this.getRegisteredFormElements();
|
|
4289
4302
|
for (const inputElement of inputElements){
|
|
4290
4303
|
const type = inputElement.getAttribute("type");
|
|
4291
|
-
if ("radio" === type || "
|
|
4292
|
-
else inputElement.removeEventListener("input", this.
|
|
4304
|
+
if ("radio" === type || "SELECT" === inputElement.tagName) inputElement.removeEventListener("change", this.validate);
|
|
4305
|
+
else inputElement.removeEventListener("input", this.validate);
|
|
4293
4306
|
}
|
|
4294
4307
|
}
|
|
4295
4308
|
hideSubmitButton() {
|
|
@@ -4299,7 +4312,7 @@ class Form extends util_Despot {
|
|
|
4299
4312
|
unload() {
|
|
4300
4313
|
this.options.logger.debug("Form: unload()");
|
|
4301
4314
|
this.removeAllInputListeners();
|
|
4302
|
-
|
|
4315
|
+
this.removeAllListeners();
|
|
4303
4316
|
this.stopListeningToSubmitEvents();
|
|
4304
4317
|
this.resetForm();
|
|
4305
4318
|
}
|
|
@@ -4309,7 +4322,7 @@ class Form extends util_Despot {
|
|
|
4309
4322
|
const inputElements = this.getRegisteredFormElements();
|
|
4310
4323
|
for (const inputElement of inputElements){
|
|
4311
4324
|
const type = inputElement.getAttribute("type");
|
|
4312
|
-
if (type?.toLowerCase() === "hidden") inputElement.
|
|
4325
|
+
if (type?.toLowerCase() === "hidden") inputElement.value = "";
|
|
4313
4326
|
}
|
|
4314
4327
|
}
|
|
4315
4328
|
startListeningToSubmitEvents() {
|
|
@@ -4359,7 +4372,9 @@ class Form extends util_Despot {
|
|
|
4359
4372
|
html_showElement(this.formElement);
|
|
4360
4373
|
}
|
|
4361
4374
|
constructor(container, formElement, options){
|
|
4362
|
-
super("Form", options), form_define_property(this, "container", void 0), form_define_property(this, "formElement", void 0), form_define_property(this, "
|
|
4375
|
+
super("Form", options), form_define_property(this, "container", void 0), form_define_property(this, "formElement", void 0), form_define_property(this, "validate", (event)=>{
|
|
4376
|
+
this.container.validate(event);
|
|
4377
|
+
}), form_define_property(this, "keyInput", void 0), form_define_property(this, "FORM_FIELDS", {});
|
|
4363
4378
|
this.container = container;
|
|
4364
4379
|
this.formElement = formElement;
|
|
4365
4380
|
this.FORM_FIELDS = {
|
|
@@ -5226,7 +5241,7 @@ class Buttons extends util_Despot {
|
|
|
5226
5241
|
if (this.built) {
|
|
5227
5242
|
this.reset();
|
|
5228
5243
|
this.options.logger.debug("Buttons: unload()");
|
|
5229
|
-
|
|
5244
|
+
this.removeAllListeners();
|
|
5230
5245
|
this.hide();
|
|
5231
5246
|
this.built = false;
|
|
5232
5247
|
}
|
|
@@ -5276,7 +5291,8 @@ class Countdown {
|
|
|
5276
5291
|
fire(cb) {
|
|
5277
5292
|
this.unload();
|
|
5278
5293
|
this.hide();
|
|
5279
|
-
setTimeout(
|
|
5294
|
+
this.fireTimeoutId = window.setTimeout(()=>{
|
|
5295
|
+
this.fireTimeoutId = void 0;
|
|
5280
5296
|
cb();
|
|
5281
5297
|
}, 0);
|
|
5282
5298
|
}
|
|
@@ -5286,15 +5302,16 @@ class Countdown {
|
|
|
5286
5302
|
if (void 0 !== this.countdown) {
|
|
5287
5303
|
this.countdown--;
|
|
5288
5304
|
if (this.countdown < 1) this.fire(cb);
|
|
5289
|
-
else if (this.countdownElement) this.countdownElement.
|
|
5305
|
+
else if (this.countdownElement) this.countdownElement.textContent = this.countdown.toString();
|
|
5290
5306
|
}
|
|
5291
5307
|
}
|
|
5292
5308
|
}
|
|
5293
5309
|
start(cb) {
|
|
5294
5310
|
if (!this.countdownElement) throw new Error("Unable to start countdown without an element");
|
|
5295
5311
|
if ("number" != typeof this.options.video.countdown) throw new TypeError(`The defined countdown is not a valid number: ${this.options.video.countdown}`);
|
|
5312
|
+
this.unload();
|
|
5296
5313
|
this.countdown = this.options.video.countdown;
|
|
5297
|
-
this.countdownElement.
|
|
5314
|
+
this.countdownElement.textContent = this.countdown.toString();
|
|
5298
5315
|
this.show();
|
|
5299
5316
|
this.intervalId = window.setInterval(this.countBackward.bind(this, cb), 950);
|
|
5300
5317
|
}
|
|
@@ -5318,12 +5335,14 @@ class Countdown {
|
|
|
5318
5335
|
html_showElement(this.countdownElement);
|
|
5319
5336
|
}
|
|
5320
5337
|
isCountingDown() {
|
|
5321
|
-
return
|
|
5338
|
+
return void 0 !== this.intervalId;
|
|
5322
5339
|
}
|
|
5323
5340
|
unload() {
|
|
5324
|
-
clearInterval(this.intervalId);
|
|
5341
|
+
if (void 0 !== this.intervalId) window.clearInterval(this.intervalId);
|
|
5342
|
+
if (void 0 !== this.fireTimeoutId) window.clearTimeout(this.fireTimeoutId);
|
|
5325
5343
|
this.paused = false;
|
|
5326
5344
|
this.intervalId = void 0;
|
|
5345
|
+
this.fireTimeoutId = void 0;
|
|
5327
5346
|
}
|
|
5328
5347
|
hide() {
|
|
5329
5348
|
html_hideElement(this.countdownElement);
|
|
@@ -5334,6 +5353,7 @@ class Countdown {
|
|
|
5334
5353
|
countdown_define_property(this, "options", void 0);
|
|
5335
5354
|
countdown_define_property(this, "countdownElement", void 0);
|
|
5336
5355
|
countdown_define_property(this, "intervalId", void 0);
|
|
5356
|
+
countdown_define_property(this, "fireTimeoutId", void 0);
|
|
5337
5357
|
countdown_define_property(this, "countdown", void 0);
|
|
5338
5358
|
countdown_define_property(this, "paused", false);
|
|
5339
5359
|
this.visuals = visuals;
|
|
@@ -6329,7 +6349,7 @@ class UserMedia extends util_Despot {
|
|
|
6329
6349
|
});
|
|
6330
6350
|
}
|
|
6331
6351
|
audioRecord(audioCallback) {
|
|
6332
|
-
|
|
6352
|
+
this.removeListener("SENDING_FIRST_FRAME");
|
|
6333
6353
|
this.audioRecorder?.record(audioCallback);
|
|
6334
6354
|
}
|
|
6335
6355
|
init(localMediaStream, videoCallback, audioCallback, endedEarlyCallback, switchingFacingMode) {
|
|
@@ -6345,7 +6365,7 @@ class UserMedia extends util_Despot {
|
|
|
6345
6365
|
const unloadAllEventListeners = ()=>{
|
|
6346
6366
|
this.options.logger.debug("UserMedia: unloadAllEventListeners()");
|
|
6347
6367
|
this.unloadRemainingEventListeners();
|
|
6348
|
-
|
|
6368
|
+
this.removeListener("SENDING_FIRST_FRAME");
|
|
6349
6369
|
this.rawVisualUserMedia?.removeEventListener("play", onPlay);
|
|
6350
6370
|
this.rawVisualUserMedia?.removeEventListener("loadedmetadata", onLoadedMetaData);
|
|
6351
6371
|
};
|
|
@@ -7002,7 +7022,7 @@ class Recorder extends util_Despot {
|
|
|
7002
7022
|
this.clearUserMediaTimeout();
|
|
7003
7023
|
const characteristics = this.userMedia?.getCharacteristics();
|
|
7004
7024
|
this.options.logger.debug(`Recorder: userMediaErrorCallback(), name: ${err.name}, message: ${err.message} and Webcam characteristics: ${characteristics ? util_pretty(characteristics) : "none"}`);
|
|
7005
|
-
const errorListeners =
|
|
7025
|
+
const errorListeners = this.getListeners("ERROR");
|
|
7006
7026
|
if (errorListeners?.length) {
|
|
7007
7027
|
if (err.name !== error_VideomailError.MEDIA_DEVICE_NOT_SUPPORTED) {
|
|
7008
7028
|
const videomailError = error_createError({
|
|
@@ -7105,7 +7125,7 @@ class Recorder extends util_Despot {
|
|
|
7105
7125
|
this.clearUserMediaTimeout();
|
|
7106
7126
|
this.options.logger.debug("Recorder: failed to load genuine user media");
|
|
7107
7127
|
this.userMediaLoading = false;
|
|
7108
|
-
const errorListeners =
|
|
7128
|
+
const errorListeners = this.getListeners("ERROR");
|
|
7109
7129
|
if (errorListeners?.length) this.emit("ERROR", {
|
|
7110
7130
|
exc
|
|
7111
7131
|
});
|
|
@@ -7734,12 +7754,12 @@ class Replay extends util_Despot {
|
|
|
7734
7754
|
heightValue = this.videomail.height;
|
|
7735
7755
|
if (widthValue && heightValue) ratio = heightValue / widthValue;
|
|
7736
7756
|
}
|
|
7737
|
-
if (!widthValue) {
|
|
7757
|
+
if (!widthValue && (videoHeight > 0 || this.options.video.height)) {
|
|
7738
7758
|
const newWidthDimensions = dimensions_calculateWidth(responsive, this.options, videoHeight, ratio);
|
|
7739
7759
|
const newWidth = newWidthDimensions.value;
|
|
7740
7760
|
widthValue = newWidth;
|
|
7741
7761
|
}
|
|
7742
|
-
if (!heightValue) {
|
|
7762
|
+
if (!heightValue && (videoWidth > 0 || this.options.video.width)) {
|
|
7743
7763
|
let element = this.visuals.getElement();
|
|
7744
7764
|
if (!element) element = document.body;
|
|
7745
7765
|
const newDimensions = dimensions_calculateHeight(responsive, videoWidth, this.options, ratio, element);
|
|
@@ -7752,6 +7772,7 @@ class Replay extends util_Despot {
|
|
|
7752
7772
|
}
|
|
7753
7773
|
setVideomail(newVideomail, playerOnly = false) {
|
|
7754
7774
|
this.videomail = newVideomail;
|
|
7775
|
+
this.replayElement?.setAttribute("controls", "controls");
|
|
7755
7776
|
if (this.videomail.mp4) this.setMp4Source(this.videomail.mp4);
|
|
7756
7777
|
if (this.videomail.webm) this.setWebMSource(this.videomail.webm);
|
|
7757
7778
|
if (this.videomail.vtt) this.setTrackSource(this.videomail.vtt);
|
|
@@ -7774,7 +7795,7 @@ class Replay extends util_Despot {
|
|
|
7774
7795
|
} else html_showElement(this.replayElement);
|
|
7775
7796
|
if (playerOnly) html_showElement(this.replayElement.parentElement);
|
|
7776
7797
|
else this.visuals.show();
|
|
7777
|
-
if (hasAudio) this.replayElement.
|
|
7798
|
+
if (hasAudio) this.replayElement.volume = 1;
|
|
7778
7799
|
else if (!isAudioEnabled(this.options)) this.replayElement.setAttribute("muted", "true");
|
|
7779
7800
|
this.replayElement.load();
|
|
7780
7801
|
if (this.videomail) this.replayElement.addEventListener("canplaythrough", ()=>{
|
|
@@ -7835,7 +7856,7 @@ class Replay extends util_Despot {
|
|
|
7835
7856
|
}
|
|
7836
7857
|
unload(params) {
|
|
7837
7858
|
this.options.logger.debug("Replay: unload()");
|
|
7838
|
-
|
|
7859
|
+
this.removeAllListeners();
|
|
7839
7860
|
if (params?.startingOver) this.hide();
|
|
7840
7861
|
else {
|
|
7841
7862
|
this.replayElement?.remove();
|
|
@@ -8467,7 +8488,7 @@ class Container extends util_Despot {
|
|
|
8467
8488
|
exc
|
|
8468
8489
|
});
|
|
8469
8490
|
} finally{
|
|
8470
|
-
|
|
8491
|
+
this.removeAllListeners();
|
|
8471
8492
|
this.built = this.submitted = false;
|
|
8472
8493
|
}
|
|
8473
8494
|
}
|
|
@@ -2,13 +2,14 @@ import { VideomailEvents } from "../types/events/index.js";
|
|
|
2
2
|
import { VideomailClientOptions } from "../types/options.js";
|
|
3
3
|
declare class Despot {
|
|
4
4
|
private readonly name;
|
|
5
|
+
private readonly emitter;
|
|
5
6
|
protected options: VideomailClientOptions;
|
|
6
|
-
|
|
7
|
+
private static readonly emitters;
|
|
7
8
|
protected constructor(name: string, options: VideomailClientOptions);
|
|
8
9
|
protected emit<E extends keyof VideomailEvents>(eventName: E, ...params: Parameters<VideomailEvents[E]>): void;
|
|
9
10
|
on<E extends keyof VideomailEvents>(eventName: E, callback: VideomailEvents[E]): import("nanoevents").Unsubscribe;
|
|
10
11
|
once<E extends keyof VideomailEvents>(eventName: E, listener: VideomailEvents[E]): import("nanoevents").Unsubscribe;
|
|
11
|
-
protected
|
|
12
|
+
protected getListeners<E extends keyof VideomailEvents>(eventName: E): Partial<{
|
|
12
13
|
ASKING_WEBCAM_PERMISSION: (() => void)[];
|
|
13
14
|
BEGIN_AUDIO_ENCODING: (() => void)[];
|
|
14
15
|
BEGIN_VIDEO_ENCODING: (() => void)[];
|
|
@@ -54,7 +55,7 @@ declare class Despot {
|
|
|
54
55
|
VISIBLE: (() => void)[];
|
|
55
56
|
WINDOW_RESIZE: ((source: string) => void)[];
|
|
56
57
|
}>[E];
|
|
57
|
-
protected
|
|
58
|
-
protected
|
|
58
|
+
protected removeListener(eventName: keyof VideomailEvents): void;
|
|
59
|
+
protected removeAllListeners(): void;
|
|
59
60
|
}
|
|
60
61
|
export default Despot;
|
|
@@ -12,6 +12,7 @@ export type FormMethodType = (typeof FormMethod)[keyof typeof FormMethod];
|
|
|
12
12
|
declare class Form extends Despot {
|
|
13
13
|
private readonly container;
|
|
14
14
|
private readonly formElement;
|
|
15
|
+
private readonly validate;
|
|
15
16
|
private keyInput?;
|
|
16
17
|
private readonly FORM_FIELDS;
|
|
17
18
|
constructor(container: Container, formElement: HTMLFormElement, options: VideomailClientOptions);
|
package/dist/umd/index.js
CHANGED
|
@@ -10978,7 +10978,7 @@
|
|
|
10978
10978
|
var client = __webpack_require__("Q");
|
|
10979
10979
|
var client_default = /*#__PURE__*/ __webpack_require__.n(client);
|
|
10980
10980
|
var package_namespaceObject = {
|
|
10981
|
-
rE: "15.7.
|
|
10981
|
+
rE: "15.7.18"
|
|
10982
10982
|
};
|
|
10983
10983
|
function isAudioEnabled(options) {
|
|
10984
10984
|
return Boolean(options.audio.enabled);
|
|
@@ -14760,11 +14760,18 @@
|
|
|
14760
14760
|
});
|
|
14761
14761
|
class Despot {
|
|
14762
14762
|
name;
|
|
14763
|
+
emitter;
|
|
14763
14764
|
options;
|
|
14764
|
-
static
|
|
14765
|
+
static emitters = new WeakMap();
|
|
14765
14766
|
constructor(name, options){
|
|
14766
14767
|
this.name = name;
|
|
14767
14768
|
this.options = options;
|
|
14769
|
+
let emitter = Despot.emitters.get(options);
|
|
14770
|
+
if (!emitter) {
|
|
14771
|
+
emitter = createNanoEvents();
|
|
14772
|
+
Despot.emitters.set(options, emitter);
|
|
14773
|
+
}
|
|
14774
|
+
this.emitter = emitter;
|
|
14768
14775
|
}
|
|
14769
14776
|
emit(eventName, ...params) {
|
|
14770
14777
|
const firstParam = params[0];
|
|
@@ -14772,18 +14779,18 @@
|
|
|
14772
14779
|
if (showParams) this.options.logger.debug(`${this.name} emits ${eventName} with ${util_pretty(params)}`);
|
|
14773
14780
|
else this.options.logger.debug(`${this.name} emits ${eventName}`);
|
|
14774
14781
|
try {
|
|
14775
|
-
|
|
14782
|
+
this.emitter.emit(eventName, ...params);
|
|
14776
14783
|
} catch (exc) {
|
|
14777
|
-
if (exc instanceof error_VideomailError)
|
|
14784
|
+
if (exc instanceof error_VideomailError) this.emitter.emit("ERROR", {
|
|
14778
14785
|
err: exc
|
|
14779
14786
|
});
|
|
14780
|
-
else
|
|
14787
|
+
else this.emitter.emit("ERROR", {
|
|
14781
14788
|
exc
|
|
14782
14789
|
});
|
|
14783
14790
|
}
|
|
14784
14791
|
}
|
|
14785
14792
|
on(eventName, callback) {
|
|
14786
|
-
return
|
|
14793
|
+
return this.emitter.on(eventName, callback);
|
|
14787
14794
|
}
|
|
14788
14795
|
once(eventName, listener) {
|
|
14789
14796
|
const callback = (...params)=>{
|
|
@@ -14793,14 +14800,14 @@
|
|
|
14793
14800
|
const unbind = this.on(eventName, callback);
|
|
14794
14801
|
return unbind;
|
|
14795
14802
|
}
|
|
14796
|
-
|
|
14797
|
-
return
|
|
14803
|
+
getListeners(eventName) {
|
|
14804
|
+
return this.emitter.events[eventName];
|
|
14798
14805
|
}
|
|
14799
|
-
|
|
14800
|
-
delete
|
|
14806
|
+
removeListener(eventName) {
|
|
14807
|
+
delete this.emitter.events[eventName];
|
|
14801
14808
|
}
|
|
14802
|
-
|
|
14803
|
-
|
|
14809
|
+
removeAllListeners() {
|
|
14810
|
+
this.emitter.events = {};
|
|
14804
14811
|
}
|
|
14805
14812
|
}
|
|
14806
14813
|
const util_Despot = Despot;
|
|
@@ -14839,6 +14846,9 @@
|
|
|
14839
14846
|
class Form extends util_Despot {
|
|
14840
14847
|
container;
|
|
14841
14848
|
formElement;
|
|
14849
|
+
validate = (event)=>{
|
|
14850
|
+
this.container.validate(event);
|
|
14851
|
+
};
|
|
14842
14852
|
keyInput;
|
|
14843
14853
|
FORM_FIELDS = {};
|
|
14844
14854
|
constructor(container, formElement, options){
|
|
@@ -14897,27 +14907,33 @@
|
|
|
14897
14907
|
this.options.logger.debug("Form: loadVideomail()");
|
|
14898
14908
|
for (const formControl of this.formElement.elements){
|
|
14899
14909
|
const name = formControl.getAttribute("name");
|
|
14900
|
-
if (name) {
|
|
14910
|
+
if (name && this.isRegisteredFormField(formControl)) {
|
|
14901
14911
|
let value = videomail[name];
|
|
14902
14912
|
const tagName = formControl.tagName;
|
|
14903
14913
|
if (this.options.callbacks.adjustFormValueBeforePopulating) value = this.options.callbacks.adjustFormValueBeforePopulating(name, value, videomail);
|
|
14904
|
-
switch(tagName){
|
|
14914
|
+
if (null != value) switch(tagName){
|
|
14905
14915
|
case "INPUT":
|
|
14906
14916
|
{
|
|
14907
14917
|
const inputControl = formControl;
|
|
14908
14918
|
if (Array.isArray(value)) inputControl.value = value.join(", ");
|
|
14909
|
-
else inputControl.value = value;
|
|
14919
|
+
else inputControl.value = String(value);
|
|
14910
14920
|
break;
|
|
14911
14921
|
}
|
|
14912
14922
|
case "TEXTAREA":
|
|
14913
14923
|
{
|
|
14914
14924
|
const textArea = formControl;
|
|
14915
|
-
textArea.value = value;
|
|
14925
|
+
textArea.value = String(value);
|
|
14926
|
+
break;
|
|
14927
|
+
}
|
|
14928
|
+
case "SELECT":
|
|
14929
|
+
{
|
|
14930
|
+
const select = formControl;
|
|
14931
|
+
select.value = String(value);
|
|
14916
14932
|
break;
|
|
14917
14933
|
}
|
|
14918
14934
|
default:
|
|
14919
14935
|
throw error_createError({
|
|
14920
|
-
message: `Unsupported form control tag name
|
|
14936
|
+
message: `Unsupported form control tag name ${tagName} found`,
|
|
14921
14937
|
options: this.options
|
|
14922
14938
|
});
|
|
14923
14939
|
}
|
|
@@ -14966,8 +14982,8 @@
|
|
|
14966
14982
|
for(let i = 0, len = inputElements.length; i < len; i++){
|
|
14967
14983
|
const inputElement = inputElements[i];
|
|
14968
14984
|
const type = inputElement?.getAttribute("type");
|
|
14969
|
-
if ("radio" === type ||
|
|
14970
|
-
else inputElement?.addEventListener("input", this.
|
|
14985
|
+
if ("radio" === type || inputElement?.tagName === "SELECT") inputElement?.addEventListener("change", this.validate);
|
|
14986
|
+
else inputElement?.addEventListener("input", this.validate);
|
|
14971
14987
|
}
|
|
14972
14988
|
}
|
|
14973
14989
|
this.on("PREVIEW", (params)=>{
|
|
@@ -15010,8 +15026,8 @@
|
|
|
15010
15026
|
const inputElements = this.getRegisteredFormElements();
|
|
15011
15027
|
for (const inputElement of inputElements){
|
|
15012
15028
|
const type = inputElement.getAttribute("type");
|
|
15013
|
-
if ("radio" === type || "
|
|
15014
|
-
else inputElement.removeEventListener("input", this.
|
|
15029
|
+
if ("radio" === type || "SELECT" === inputElement.tagName) inputElement.removeEventListener("change", this.validate);
|
|
15030
|
+
else inputElement.removeEventListener("input", this.validate);
|
|
15015
15031
|
}
|
|
15016
15032
|
}
|
|
15017
15033
|
hideSubmitButton() {
|
|
@@ -15021,7 +15037,7 @@
|
|
|
15021
15037
|
unload() {
|
|
15022
15038
|
this.options.logger.debug("Form: unload()");
|
|
15023
15039
|
this.removeAllInputListeners();
|
|
15024
|
-
|
|
15040
|
+
this.removeAllListeners();
|
|
15025
15041
|
this.stopListeningToSubmitEvents();
|
|
15026
15042
|
this.resetForm();
|
|
15027
15043
|
}
|
|
@@ -15031,7 +15047,7 @@
|
|
|
15031
15047
|
const inputElements = this.getRegisteredFormElements();
|
|
15032
15048
|
for (const inputElement of inputElements){
|
|
15033
15049
|
const type = inputElement.getAttribute("type");
|
|
15034
|
-
if (type?.toLowerCase() === "hidden") inputElement.
|
|
15050
|
+
if (type?.toLowerCase() === "hidden") inputElement.value = "";
|
|
15035
15051
|
}
|
|
15036
15052
|
}
|
|
15037
15053
|
startListeningToSubmitEvents() {
|
|
@@ -17915,7 +17931,7 @@
|
|
|
17915
17931
|
if (this.built) {
|
|
17916
17932
|
this.reset();
|
|
17917
17933
|
this.options.logger.debug("Buttons: unload()");
|
|
17918
|
-
|
|
17934
|
+
this.removeAllListeners();
|
|
17919
17935
|
this.hide();
|
|
17920
17936
|
this.built = false;
|
|
17921
17937
|
}
|
|
@@ -17952,6 +17968,7 @@
|
|
|
17952
17968
|
options;
|
|
17953
17969
|
countdownElement;
|
|
17954
17970
|
intervalId;
|
|
17971
|
+
fireTimeoutId;
|
|
17955
17972
|
countdown;
|
|
17956
17973
|
paused = false;
|
|
17957
17974
|
constructor(visuals, options){
|
|
@@ -17961,7 +17978,8 @@
|
|
|
17961
17978
|
fire(cb) {
|
|
17962
17979
|
this.unload();
|
|
17963
17980
|
this.hide();
|
|
17964
|
-
setTimeout(
|
|
17981
|
+
this.fireTimeoutId = window.setTimeout(()=>{
|
|
17982
|
+
this.fireTimeoutId = void 0;
|
|
17965
17983
|
cb();
|
|
17966
17984
|
}, 0);
|
|
17967
17985
|
}
|
|
@@ -17971,15 +17989,16 @@
|
|
|
17971
17989
|
if (void 0 !== this.countdown) {
|
|
17972
17990
|
this.countdown--;
|
|
17973
17991
|
if (this.countdown < 1) this.fire(cb);
|
|
17974
|
-
else if (this.countdownElement) this.countdownElement.
|
|
17992
|
+
else if (this.countdownElement) this.countdownElement.textContent = this.countdown.toString();
|
|
17975
17993
|
}
|
|
17976
17994
|
}
|
|
17977
17995
|
}
|
|
17978
17996
|
start(cb) {
|
|
17979
17997
|
if (!this.countdownElement) throw new Error("Unable to start countdown without an element");
|
|
17980
17998
|
if ("number" != typeof this.options.video.countdown) throw new TypeError(`The defined countdown is not a valid number: ${this.options.video.countdown}`);
|
|
17999
|
+
this.unload();
|
|
17981
18000
|
this.countdown = this.options.video.countdown;
|
|
17982
|
-
this.countdownElement.
|
|
18001
|
+
this.countdownElement.textContent = this.countdown.toString();
|
|
17983
18002
|
this.show();
|
|
17984
18003
|
this.intervalId = window.setInterval(this.countBackward.bind(this, cb), 950);
|
|
17985
18004
|
}
|
|
@@ -18003,12 +18022,14 @@
|
|
|
18003
18022
|
html_showElement(this.countdownElement);
|
|
18004
18023
|
}
|
|
18005
18024
|
isCountingDown() {
|
|
18006
|
-
return
|
|
18025
|
+
return void 0 !== this.intervalId;
|
|
18007
18026
|
}
|
|
18008
18027
|
unload() {
|
|
18009
|
-
clearInterval(this.intervalId);
|
|
18028
|
+
if (void 0 !== this.intervalId) window.clearInterval(this.intervalId);
|
|
18029
|
+
if (void 0 !== this.fireTimeoutId) window.clearTimeout(this.fireTimeoutId);
|
|
18010
18030
|
this.paused = false;
|
|
18011
18031
|
this.intervalId = void 0;
|
|
18032
|
+
this.fireTimeoutId = void 0;
|
|
18012
18033
|
}
|
|
18013
18034
|
hide() {
|
|
18014
18035
|
html_hideElement(this.countdownElement);
|
|
@@ -19048,7 +19069,7 @@
|
|
|
19048
19069
|
});
|
|
19049
19070
|
}
|
|
19050
19071
|
audioRecord(audioCallback) {
|
|
19051
|
-
|
|
19072
|
+
this.removeListener("SENDING_FIRST_FRAME");
|
|
19052
19073
|
this.audioRecorder?.record(audioCallback);
|
|
19053
19074
|
}
|
|
19054
19075
|
init(localMediaStream, videoCallback, audioCallback, endedEarlyCallback, switchingFacingMode) {
|
|
@@ -19064,7 +19085,7 @@
|
|
|
19064
19085
|
const unloadAllEventListeners = ()=>{
|
|
19065
19086
|
this.options.logger.debug("UserMedia: unloadAllEventListeners()");
|
|
19066
19087
|
this.unloadRemainingEventListeners();
|
|
19067
|
-
|
|
19088
|
+
this.removeListener("SENDING_FIRST_FRAME");
|
|
19068
19089
|
this.rawVisualUserMedia?.removeEventListener("play", onPlay);
|
|
19069
19090
|
this.rawVisualUserMedia?.removeEventListener("loadedmetadata", onLoadedMetaData);
|
|
19070
19091
|
};
|
|
@@ -19747,7 +19768,7 @@
|
|
|
19747
19768
|
this.clearUserMediaTimeout();
|
|
19748
19769
|
const characteristics = this.userMedia?.getCharacteristics();
|
|
19749
19770
|
this.options.logger.debug(`Recorder: userMediaErrorCallback(), name: ${err.name}, message: ${err.message} and Webcam characteristics: ${characteristics ? util_pretty(characteristics) : "none"}`);
|
|
19750
|
-
const errorListeners =
|
|
19771
|
+
const errorListeners = this.getListeners("ERROR");
|
|
19751
19772
|
if (errorListeners?.length) {
|
|
19752
19773
|
if (err.name !== error_VideomailError.MEDIA_DEVICE_NOT_SUPPORTED) {
|
|
19753
19774
|
const videomailError = error_createError({
|
|
@@ -19850,7 +19871,7 @@
|
|
|
19850
19871
|
this.clearUserMediaTimeout();
|
|
19851
19872
|
this.options.logger.debug("Recorder: failed to load genuine user media");
|
|
19852
19873
|
this.userMediaLoading = false;
|
|
19853
|
-
const errorListeners =
|
|
19874
|
+
const errorListeners = this.getListeners("ERROR");
|
|
19854
19875
|
if (errorListeners?.length) this.emit("ERROR", {
|
|
19855
19876
|
exc
|
|
19856
19877
|
});
|
|
@@ -20471,12 +20492,12 @@
|
|
|
20471
20492
|
heightValue = this.videomail.height;
|
|
20472
20493
|
if (widthValue && heightValue) ratio = heightValue / widthValue;
|
|
20473
20494
|
}
|
|
20474
|
-
if (!widthValue) {
|
|
20495
|
+
if (!widthValue && (videoHeight > 0 || this.options.video.height)) {
|
|
20475
20496
|
const newWidthDimensions = dimensions_calculateWidth(responsive, this.options, videoHeight, ratio);
|
|
20476
20497
|
const newWidth = newWidthDimensions.value;
|
|
20477
20498
|
widthValue = newWidth;
|
|
20478
20499
|
}
|
|
20479
|
-
if (!heightValue) {
|
|
20500
|
+
if (!heightValue && (videoWidth > 0 || this.options.video.width)) {
|
|
20480
20501
|
let element = this.visuals.getElement();
|
|
20481
20502
|
if (!element) element = document.body;
|
|
20482
20503
|
const newDimensions = dimensions_calculateHeight(responsive, videoWidth, this.options, ratio, element);
|
|
@@ -20489,6 +20510,7 @@
|
|
|
20489
20510
|
}
|
|
20490
20511
|
setVideomail(newVideomail, playerOnly = false) {
|
|
20491
20512
|
this.videomail = newVideomail;
|
|
20513
|
+
this.replayElement?.setAttribute("controls", "controls");
|
|
20492
20514
|
if (this.videomail.mp4) this.setMp4Source(this.videomail.mp4);
|
|
20493
20515
|
if (this.videomail.webm) this.setWebMSource(this.videomail.webm);
|
|
20494
20516
|
if (this.videomail.vtt) this.setTrackSource(this.videomail.vtt);
|
|
@@ -20511,7 +20533,7 @@
|
|
|
20511
20533
|
} else html_showElement(this.replayElement);
|
|
20512
20534
|
if (playerOnly) html_showElement(this.replayElement.parentElement);
|
|
20513
20535
|
else this.visuals.show();
|
|
20514
|
-
if (hasAudio) this.replayElement.
|
|
20536
|
+
if (hasAudio) this.replayElement.volume = 1;
|
|
20515
20537
|
else if (!isAudioEnabled(this.options)) this.replayElement.setAttribute("muted", "true");
|
|
20516
20538
|
this.replayElement.load();
|
|
20517
20539
|
if (this.videomail) this.replayElement.addEventListener("canplaythrough", ()=>{
|
|
@@ -20572,7 +20594,7 @@
|
|
|
20572
20594
|
}
|
|
20573
20595
|
unload(params) {
|
|
20574
20596
|
this.options.logger.debug("Replay: unload()");
|
|
20575
|
-
|
|
20597
|
+
this.removeAllListeners();
|
|
20576
20598
|
if (params?.startingOver) this.hide();
|
|
20577
20599
|
else {
|
|
20578
20600
|
this.replayElement?.remove();
|
|
@@ -21204,7 +21226,7 @@
|
|
|
21204
21226
|
exc
|
|
21205
21227
|
});
|
|
21206
21228
|
} finally{
|
|
21207
|
-
|
|
21229
|
+
this.removeAllListeners();
|
|
21208
21230
|
this.built = this.submitted = false;
|
|
21209
21231
|
}
|
|
21210
21232
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "videomail-client",
|
|
3
|
-
"version": "15.7.
|
|
3
|
+
"version": "15.7.18",
|
|
4
4
|
"description": "A wicked npm package to record videos directly in the browser, for Deaf and Sign Language!",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"webcam",
|
|
@@ -51,6 +51,7 @@
|
|
|
51
51
|
"lint:inspect": "eslint --inspect-config",
|
|
52
52
|
"prettier": "prettier --check ./etc ./src ./.storybook *.ts *.js",
|
|
53
53
|
"prettier:fix": "prettier --write ./etc ./src ./.storybook *.ts *.js",
|
|
54
|
+
"quality": "npm run test && npm run prettier && npm run lint && npm run types",
|
|
54
55
|
"release": "release-it --only-version --config ./etc/release-it.ts",
|
|
55
56
|
"storybook": "cross-env BROWSER=chromium storybook dev -p 8443 --https --ssl-cert ./etc/ssl-certs/localhost.crt --ssl-key ./etc/ssl-certs/localhost.key",
|
|
56
57
|
"test": "cross-env ENVIRON=test vitest --watch=false",
|