videomail-client 8.3.1 → 8.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/prototype/js/videomail-client.js +12 -14
- package/prototype/js/videomail-client.min.js +1 -1
- package/prototype/js/videomail-client.min.js.map +1 -1
- package/src/js/client.js +0 -210
- package/src/js/constants.js +0 -11
- package/src/js/events.js +0 -46
- package/src/js/index.js +0 -15
- package/src/js/options.js +0 -180
- package/src/js/resource.js +0 -206
- package/src/js/util/audioRecorder.js +0 -152
- package/src/js/util/browser.js +0 -319
- package/src/js/util/collectLogger.js +0 -72
- package/src/js/util/eventEmitter.js +0 -72
- package/src/js/util/humanize.js +0 -16
- package/src/js/util/mediaEvents.js +0 -148
- package/src/js/util/pretty.js +0 -70
- package/src/js/util/standardize.js +0 -71
- package/src/js/util/videomailError.js +0 -431
- package/src/js/wrappers/buttons.js +0 -670
- package/src/js/wrappers/container.js +0 -797
- package/src/js/wrappers/dimension.js +0 -149
- package/src/js/wrappers/form.js +0 -319
- package/src/js/wrappers/optionsWrapper.js +0 -81
- package/src/js/wrappers/visuals/inside/recorder/countdown.js +0 -83
- package/src/js/wrappers/visuals/inside/recorder/facingMode.js +0 -53
- package/src/js/wrappers/visuals/inside/recorder/pausedNote.js +0 -59
- package/src/js/wrappers/visuals/inside/recorder/recordNote.js +0 -42
- package/src/js/wrappers/visuals/inside/recorder/recordTimer.js +0 -149
- package/src/js/wrappers/visuals/inside/recorderInsides.js +0 -144
- package/src/js/wrappers/visuals/notifier.js +0 -341
- package/src/js/wrappers/visuals/recorder.js +0 -1492
- package/src/js/wrappers/visuals/replay.js +0 -355
- package/src/js/wrappers/visuals/userMedia.js +0 -541
- package/src/js/wrappers/visuals.js +0 -410
- package/src/styles/css/main.min.css.js +0 -1
- package/src/styles/styl/keyframes/blink.styl +0 -16
- package/src/styles/styl/main.styl +0 -126
|
@@ -1,341 +0,0 @@
|
|
|
1
|
-
import hidden from "hidden";
|
|
2
|
-
import h from "hyperscript";
|
|
3
|
-
import inherits from "inherits";
|
|
4
|
-
|
|
5
|
-
import Events from "../../events";
|
|
6
|
-
import EventEmitter from "../../util/eventEmitter";
|
|
7
|
-
|
|
8
|
-
const Notifier = function (visuals, options) {
|
|
9
|
-
EventEmitter.call(this, options, "Notifier");
|
|
10
|
-
|
|
11
|
-
const self = this;
|
|
12
|
-
const debug = options && options.debug;
|
|
13
|
-
|
|
14
|
-
let notifyElement;
|
|
15
|
-
let messageElement;
|
|
16
|
-
let explanationElement;
|
|
17
|
-
let entertainTimeoutId;
|
|
18
|
-
let entertaining;
|
|
19
|
-
let built;
|
|
20
|
-
|
|
21
|
-
function onStopping(limitReached) {
|
|
22
|
-
let lead = "";
|
|
23
|
-
|
|
24
|
-
visuals.beginWaiting();
|
|
25
|
-
|
|
26
|
-
if (limitReached) {
|
|
27
|
-
debug("Limit reached");
|
|
28
|
-
lead += `${options.text.limitReached}.<br/>`;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
lead += `${options.text.sending} …`;
|
|
32
|
-
|
|
33
|
-
self.notify(lead, null, {
|
|
34
|
-
stillWait: true,
|
|
35
|
-
entertain: options.notifier.entertain,
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
function onConnecting() {
|
|
40
|
-
self.notify("Connecting …");
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
function onLoadingUserMedia() {
|
|
44
|
-
self.notify("Loading webcam …");
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
function onProgress(frameProgress, sampleProgress) {
|
|
48
|
-
let overallProgress;
|
|
49
|
-
|
|
50
|
-
if (options.isAudioEnabled()) {
|
|
51
|
-
overallProgress = `Video: ${frameProgress}`;
|
|
52
|
-
|
|
53
|
-
if (sampleProgress) {
|
|
54
|
-
overallProgress += `, Audio: ${sampleProgress}`;
|
|
55
|
-
}
|
|
56
|
-
} else {
|
|
57
|
-
overallProgress = frameProgress;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
self.setExplanation(overallProgress);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
function onBeginVideoEncoding() {
|
|
64
|
-
visuals.beginWaiting();
|
|
65
|
-
|
|
66
|
-
const lead = `${options.text.encoding} …`;
|
|
67
|
-
|
|
68
|
-
self.notify(lead, null, {
|
|
69
|
-
stillWait: true,
|
|
70
|
-
entertain: options.notifier.entertain,
|
|
71
|
-
});
|
|
72
|
-
|
|
73
|
-
hideExplanation();
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
function initEvents() {
|
|
77
|
-
debug("Notifier: initEvents()");
|
|
78
|
-
|
|
79
|
-
self
|
|
80
|
-
.on(Events.CONNECTING, function () {
|
|
81
|
-
onConnecting();
|
|
82
|
-
})
|
|
83
|
-
.on(Events.LOADING_USER_MEDIA, function () {
|
|
84
|
-
onLoadingUserMedia();
|
|
85
|
-
})
|
|
86
|
-
.on(Events.USER_MEDIA_READY, function () {
|
|
87
|
-
// Ensure notifier has correct dimensions, especially when stretched
|
|
88
|
-
correctNotifierDimensions();
|
|
89
|
-
|
|
90
|
-
self.hide();
|
|
91
|
-
})
|
|
92
|
-
.on(Events.LOADED_META_DATA, function () {})
|
|
93
|
-
.on(Events.PREVIEW, function () {
|
|
94
|
-
self.hide();
|
|
95
|
-
})
|
|
96
|
-
.on(Events.STOPPING, function (limitReached) {
|
|
97
|
-
onStopping(limitReached);
|
|
98
|
-
})
|
|
99
|
-
.on(Events.PROGRESS, function (frameProgress, sampleProgress) {
|
|
100
|
-
onProgress(frameProgress, sampleProgress);
|
|
101
|
-
})
|
|
102
|
-
.on(Events.BEGIN_VIDEO_ENCODING, function () {
|
|
103
|
-
onBeginVideoEncoding();
|
|
104
|
-
})
|
|
105
|
-
.on(Events.CONNECTED, function () {
|
|
106
|
-
self.notify("Connected.");
|
|
107
|
-
|
|
108
|
-
if (options.loadUserMediaOnRecord) {
|
|
109
|
-
self.hide();
|
|
110
|
-
}
|
|
111
|
-
});
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
function correctNotifierDimensions() {
|
|
115
|
-
if (options.video.stretch) {
|
|
116
|
-
notifyElement.style.width = "auto";
|
|
117
|
-
notifyElement.style.height = `${visuals.getRecorderHeight(true, true)}px`;
|
|
118
|
-
} else {
|
|
119
|
-
notifyElement.style.width = `${visuals.getRecorderWidth(true)}px`;
|
|
120
|
-
notifyElement.style.height = `${visuals.getRecorderHeight(true)}px`;
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
function show() {
|
|
125
|
-
notifyElement && hidden(notifyElement, false);
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
function runEntertainment() {
|
|
129
|
-
if (options.notifier.entertain) {
|
|
130
|
-
if (!entertaining) {
|
|
131
|
-
const randomBackgroundClass = Math.floor(
|
|
132
|
-
Math.random() * options.notifier.entertainLimit + 1,
|
|
133
|
-
);
|
|
134
|
-
|
|
135
|
-
notifyElement.className = `notifier entertain ${options.notifier.entertainClass}${randomBackgroundClass}`;
|
|
136
|
-
|
|
137
|
-
entertainTimeoutId = setTimeout(
|
|
138
|
-
runEntertainment,
|
|
139
|
-
options.notifier.entertainInterval,
|
|
140
|
-
);
|
|
141
|
-
entertaining = true;
|
|
142
|
-
}
|
|
143
|
-
} else {
|
|
144
|
-
cancelEntertainment();
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
function cancelEntertainment() {
|
|
149
|
-
if (notifyElement) {
|
|
150
|
-
notifyElement.classList.remove("entertain");
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
clearTimeout(entertainTimeoutId);
|
|
154
|
-
entertainTimeoutId = null;
|
|
155
|
-
entertaining = false;
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
function setMessage(message, messageOptions) {
|
|
159
|
-
const problem = messageOptions.problem ? messageOptions.problem : false;
|
|
160
|
-
|
|
161
|
-
if (messageElement) {
|
|
162
|
-
messageElement.innerHTML = (problem ? "☹ " : "") + message;
|
|
163
|
-
} else {
|
|
164
|
-
options.logger.warn(
|
|
165
|
-
"Unable to show following because messageElement is empty:",
|
|
166
|
-
message,
|
|
167
|
-
);
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
this.error = function (err) {
|
|
172
|
-
const message = err.message ? err.message.toString() : err.toString();
|
|
173
|
-
const explanation = err.explanation ? err.explanation.toString() : null;
|
|
174
|
-
|
|
175
|
-
if (!message) {
|
|
176
|
-
options.debug("Weird empty message generated for error", err);
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
self.notify(message, explanation, {
|
|
180
|
-
blocking: true,
|
|
181
|
-
problem: true,
|
|
182
|
-
hideForm: err.hideForm && err.hideForm(),
|
|
183
|
-
classList: err.getClassList && err.getClassList(),
|
|
184
|
-
removeDimensions: err.removeDimensions && err.removeDimensions(),
|
|
185
|
-
});
|
|
186
|
-
};
|
|
187
|
-
|
|
188
|
-
this.setExplanation = function (explanation) {
|
|
189
|
-
if (!explanationElement) {
|
|
190
|
-
explanationElement = h("p");
|
|
191
|
-
|
|
192
|
-
if (notifyElement) {
|
|
193
|
-
notifyElement.appendChild(explanationElement);
|
|
194
|
-
} else {
|
|
195
|
-
options.logger.warn(
|
|
196
|
-
"Unable to show explanation because notifyElement is empty:",
|
|
197
|
-
explanation,
|
|
198
|
-
);
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
explanationElement.innerHTML = explanation;
|
|
203
|
-
|
|
204
|
-
hidden(explanationElement, false);
|
|
205
|
-
};
|
|
206
|
-
|
|
207
|
-
this.build = function () {
|
|
208
|
-
options.debug("Notifier: build()");
|
|
209
|
-
|
|
210
|
-
notifyElement = visuals.querySelector(".notifier");
|
|
211
|
-
|
|
212
|
-
if (!notifyElement) {
|
|
213
|
-
notifyElement = h(".notifier"); // defaults to div
|
|
214
|
-
|
|
215
|
-
this.hide();
|
|
216
|
-
|
|
217
|
-
visuals.appendChild(notifyElement);
|
|
218
|
-
} else {
|
|
219
|
-
this.hide();
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
!built && initEvents();
|
|
223
|
-
|
|
224
|
-
built = true;
|
|
225
|
-
};
|
|
226
|
-
|
|
227
|
-
function hideExplanation() {
|
|
228
|
-
if (explanationElement) {
|
|
229
|
-
explanationElement.innerHTML = null;
|
|
230
|
-
hidden(explanationElement, true);
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
this.hide = function () {
|
|
235
|
-
cancelEntertainment();
|
|
236
|
-
|
|
237
|
-
if (notifyElement) {
|
|
238
|
-
hidden(notifyElement, true);
|
|
239
|
-
notifyElement.classList.remove("blocking");
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
if (messageElement) {
|
|
243
|
-
messageElement.innerHTML = null;
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
hideExplanation();
|
|
247
|
-
};
|
|
248
|
-
|
|
249
|
-
this.isVisible = function () {
|
|
250
|
-
if (!built) {
|
|
251
|
-
return false;
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
return notifyElement && !hidden(notifyElement);
|
|
255
|
-
};
|
|
256
|
-
|
|
257
|
-
this.isBuilt = function () {
|
|
258
|
-
return built;
|
|
259
|
-
};
|
|
260
|
-
|
|
261
|
-
this.notify = function (message, explanation, notifyOptions) {
|
|
262
|
-
options.debug("Notifier: notify()");
|
|
263
|
-
|
|
264
|
-
if (!notifyOptions) {
|
|
265
|
-
notifyOptions = {};
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
const stillWait = notifyOptions.stillWait ? notifyOptions.stillWait : false;
|
|
269
|
-
const entertain = notifyOptions.entertain ? notifyOptions.entertain : false;
|
|
270
|
-
const blocking = notifyOptions.blocking ? notifyOptions.blocking : false;
|
|
271
|
-
const hideForm = notifyOptions.hideForm ? notifyOptions.hideForm : false;
|
|
272
|
-
const classList = notifyOptions.classList ? notifyOptions.classList : false;
|
|
273
|
-
const removeDimensions = notifyOptions.removeDimensions
|
|
274
|
-
? notifyOptions.removeDimensions
|
|
275
|
-
: false;
|
|
276
|
-
|
|
277
|
-
if (!messageElement && notifyElement) {
|
|
278
|
-
messageElement = h("h2");
|
|
279
|
-
|
|
280
|
-
if (explanationElement) {
|
|
281
|
-
notifyElement.insertBefore(messageElement, explanationElement);
|
|
282
|
-
} else {
|
|
283
|
-
notifyElement.appendChild(messageElement);
|
|
284
|
-
}
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
if (notifyElement) {
|
|
288
|
-
// reset
|
|
289
|
-
if (!entertain) {
|
|
290
|
-
notifyElement.className = "notifier";
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
if (classList) {
|
|
294
|
-
classList.forEach(function (className) {
|
|
295
|
-
notifyElement.classList.add(className);
|
|
296
|
-
});
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
if (removeDimensions) {
|
|
300
|
-
notifyElement.style.width = "auto";
|
|
301
|
-
notifyElement.style.height = "auto";
|
|
302
|
-
}
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
if (blocking) {
|
|
306
|
-
notifyElement && notifyElement.classList.add("blocking");
|
|
307
|
-
this.emit(Events.BLOCKING, { hideForm });
|
|
308
|
-
} else {
|
|
309
|
-
this.emit(Events.NOTIFYING);
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
visuals.hideReplay();
|
|
313
|
-
visuals.hideRecorder();
|
|
314
|
-
|
|
315
|
-
setMessage(message, notifyOptions);
|
|
316
|
-
|
|
317
|
-
if (explanation && explanation.length > 0) {
|
|
318
|
-
this.setExplanation(explanation);
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
if (entertain) {
|
|
322
|
-
runEntertainment();
|
|
323
|
-
} else {
|
|
324
|
-
cancelEntertainment();
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
/*
|
|
328
|
-
* just as a safety in case if an error is thrown in the middle of the build process
|
|
329
|
-
* and visuals aren't built/shown yet.
|
|
330
|
-
*/
|
|
331
|
-
visuals.showVisuals();
|
|
332
|
-
|
|
333
|
-
show();
|
|
334
|
-
|
|
335
|
-
!stillWait && visuals.endWaiting();
|
|
336
|
-
};
|
|
337
|
-
};
|
|
338
|
-
|
|
339
|
-
inherits(Notifier, EventEmitter);
|
|
340
|
-
|
|
341
|
-
export default Notifier;
|