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.
Files changed (38) hide show
  1. package/package.json +1 -1
  2. package/prototype/js/videomail-client.js +12 -14
  3. package/prototype/js/videomail-client.min.js +1 -1
  4. package/prototype/js/videomail-client.min.js.map +1 -1
  5. package/src/js/client.js +0 -210
  6. package/src/js/constants.js +0 -11
  7. package/src/js/events.js +0 -46
  8. package/src/js/index.js +0 -15
  9. package/src/js/options.js +0 -180
  10. package/src/js/resource.js +0 -206
  11. package/src/js/util/audioRecorder.js +0 -152
  12. package/src/js/util/browser.js +0 -319
  13. package/src/js/util/collectLogger.js +0 -72
  14. package/src/js/util/eventEmitter.js +0 -72
  15. package/src/js/util/humanize.js +0 -16
  16. package/src/js/util/mediaEvents.js +0 -148
  17. package/src/js/util/pretty.js +0 -70
  18. package/src/js/util/standardize.js +0 -71
  19. package/src/js/util/videomailError.js +0 -431
  20. package/src/js/wrappers/buttons.js +0 -670
  21. package/src/js/wrappers/container.js +0 -797
  22. package/src/js/wrappers/dimension.js +0 -149
  23. package/src/js/wrappers/form.js +0 -319
  24. package/src/js/wrappers/optionsWrapper.js +0 -81
  25. package/src/js/wrappers/visuals/inside/recorder/countdown.js +0 -83
  26. package/src/js/wrappers/visuals/inside/recorder/facingMode.js +0 -53
  27. package/src/js/wrappers/visuals/inside/recorder/pausedNote.js +0 -59
  28. package/src/js/wrappers/visuals/inside/recorder/recordNote.js +0 -42
  29. package/src/js/wrappers/visuals/inside/recorder/recordTimer.js +0 -149
  30. package/src/js/wrappers/visuals/inside/recorderInsides.js +0 -144
  31. package/src/js/wrappers/visuals/notifier.js +0 -341
  32. package/src/js/wrappers/visuals/recorder.js +0 -1492
  33. package/src/js/wrappers/visuals/replay.js +0 -355
  34. package/src/js/wrappers/visuals/userMedia.js +0 -541
  35. package/src/js/wrappers/visuals.js +0 -410
  36. package/src/styles/css/main.min.css.js +0 -1
  37. package/src/styles/styl/keyframes/blink.styl +0 -16
  38. package/src/styles/styl/main.styl +0 -126
@@ -1,410 +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
- import RecorderInsides from "./visuals/inside/recorderInsides";
8
- import Notifier from "./visuals/notifier";
9
- import Recorder from "./visuals/recorder";
10
- import Replay from "./visuals/replay";
11
-
12
- const Visuals = function (container, options) {
13
- EventEmitter.call(this, options, "Visuals");
14
-
15
- const self = this;
16
-
17
- // can be overwritten with setter fn
18
- const replay = new Replay(this, options);
19
-
20
- const recorder = new Recorder(this, replay, options);
21
- const recorderInsides = new RecorderInsides(this, options);
22
-
23
- const notifier = new Notifier(this, options);
24
-
25
- const { debug } = options;
26
-
27
- let visualsElement;
28
- let built;
29
-
30
- function buildNoScriptTag() {
31
- let noScriptElement = container.querySelector("noscript");
32
-
33
- if (!noScriptElement) {
34
- noScriptElement = h("noscript");
35
- noScriptElement.innerHTML = "Please enable Javascript";
36
-
37
- visualsElement.appendChild(noScriptElement);
38
- }
39
- }
40
-
41
- function buildChildren() {
42
- debug("Visuals: buildChildren()");
43
-
44
- buildNoScriptTag();
45
-
46
- if (!options.playerOnly) {
47
- notifier.build();
48
- recorderInsides.build();
49
- }
50
-
51
- replay.build();
52
-
53
- debug("Visuals: built.");
54
- }
55
-
56
- function initEvents() {
57
- if (!options.playerOnly) {
58
- debug("Visuals: initEvents()");
59
-
60
- self
61
- .on(Events.USER_MEDIA_READY, function () {
62
- built = true;
63
- self.endWaiting();
64
- container.enableForm(false);
65
- })
66
- .on(Events.PREVIEW, () => {
67
- self.endWaiting();
68
- })
69
- .on(Events.BLOCKING, function (blockingOptions) {
70
- if (!blockingOptions.hideForm && !options.adjustFormOnBrowserError) {
71
- /*
72
- * do nothing, user still can enter form inputs
73
- * can be useful when you are on i.E. seeflow's contact page and
74
- * still want to tick off the webcam option
75
- */
76
- } else {
77
- container.disableForm(true);
78
- }
79
- })
80
- .on(Events.PREVIEW_SHOWN, function () {
81
- container.validate(true);
82
- })
83
- .on(Events.LOADED_META_DATA, function () {
84
- correctDimensions();
85
- })
86
- .on(Events.ERROR, function (err) {
87
- if (err.removeDimensions && err.removeDimensions()) {
88
- removeDimensions();
89
- }
90
- });
91
- }
92
- }
93
-
94
- function correctDimensions() {
95
- if (options.video.stretch) {
96
- removeDimensions();
97
- } else {
98
- visualsElement.style.width = `${self.getRecorderWidth(true)}px`;
99
- visualsElement.style.height = `${self.getRecorderHeight(true)}px`;
100
- }
101
- }
102
-
103
- function removeDimensions() {
104
- visualsElement.style.width = "auto";
105
- visualsElement.style.height = "auto";
106
- }
107
-
108
- this.getRatio = function () {
109
- if (visualsElement.clientWidth) {
110
- // special case for safari, see getRatio() in recorder
111
- return visualsElement.clientHeight / visualsElement.clientWidth;
112
- }
113
-
114
- return 0;
115
- };
116
-
117
- function isRecordable() {
118
- return !self.isNotifying() && !replay.isShown() && !self.isCountingDown();
119
- }
120
-
121
- this.isCountingDown = function () {
122
- return recorderInsides.isCountingDown();
123
- };
124
-
125
- this.build = function () {
126
- visualsElement = container.querySelector(`.${options.selectors.visualsClass}`);
127
-
128
- if (!visualsElement) {
129
- visualsElement = h(`div.${options.selectors.visualsClass}`);
130
-
131
- const buttonsElement = container.querySelector(
132
- `.${options.selectors.buttonsClass}`,
133
- );
134
-
135
- /*
136
- * make sure it's placed before the buttons, but only if it's a child
137
- * element of the container = inside the container
138
- */
139
- if (buttonsElement && !container.isOutsideElementOf(buttonsElement)) {
140
- container.insertBefore(visualsElement, buttonsElement);
141
- } else {
142
- container.appendChild(visualsElement);
143
- }
144
- }
145
-
146
- /*
147
- * do not hide visuals element so that apps can give it a predefined
148
- * width or height through css but hide all children
149
- */
150
-
151
- visualsElement.classList.add("visuals");
152
-
153
- correctDimensions();
154
-
155
- !built && initEvents();
156
- buildChildren();
157
-
158
- // needed for replay handling and container.isOutsideElementOf()
159
- self.parentNode = visualsElement.parentNode;
160
-
161
- built = true;
162
- };
163
-
164
- this.querySelector = function (selector) {
165
- return visualsElement && visualsElement.querySelector(selector);
166
- };
167
-
168
- this.appendChild = function (child) {
169
- visualsElement && visualsElement.appendChild(child);
170
- };
171
-
172
- this.removeChild = function (child) {
173
- visualsElement.removeChild(child);
174
- };
175
-
176
- this.reset = function () {
177
- this.endWaiting();
178
- recorder.reset();
179
- };
180
-
181
- this.beginWaiting = function () {
182
- container.beginWaiting();
183
- };
184
-
185
- this.endWaiting = function () {
186
- container.endWaiting();
187
- };
188
-
189
- this.stop = function (params) {
190
- recorder.stop(params);
191
- recorderInsides.hidePause();
192
- };
193
-
194
- this.back = function (params, cb) {
195
- if (!cb && params) {
196
- cb = params;
197
- params = {};
198
- }
199
-
200
- replay.hide();
201
- notifier.hide();
202
-
203
- if (params && params.keepHidden) {
204
- recorder.hide();
205
- cb && cb();
206
- } else {
207
- recorder.back(cb);
208
- }
209
- };
210
-
211
- this.recordAgain = function () {
212
- this.back(function () {
213
- if (options.loadUserMediaOnRecord) {
214
- self.once(Events.SERVER_READY, function () {
215
- self.record();
216
- });
217
- } else {
218
- self.once(Events.USER_MEDIA_READY, function () {
219
- self.record();
220
- });
221
- }
222
- });
223
- };
224
-
225
- this.unload = function (e) {
226
- try {
227
- recorder.unload(e);
228
- recorderInsides.unload(e);
229
- replay.unload(e);
230
-
231
- built = false;
232
- } catch (exc) {
233
- this.emit(Events.ERROR, exc);
234
- }
235
- };
236
-
237
- this.isNotifying = function () {
238
- return notifier.isVisible();
239
- };
240
-
241
- this.isReplayShown = function () {
242
- return replay.isShown();
243
- };
244
-
245
- this.pause = function (params) {
246
- recorder.pause(params);
247
- recorderInsides.showPause();
248
- };
249
-
250
- this.resume = function () {
251
- if (recorderInsides.isCountingDown()) {
252
- recorderInsides.resumeCountdown();
253
- } else {
254
- recorder.resume();
255
- }
256
-
257
- recorderInsides.hidePause();
258
- };
259
-
260
- this.pauseOrResume = function () {
261
- if (isRecordable.call(this)) {
262
- if (this.isRecording()) {
263
- this.pause();
264
- } else if (recorder.isPaused()) {
265
- this.resume();
266
- } else if (recorder.isReady()) {
267
- this.record();
268
- }
269
- }
270
- };
271
-
272
- this.recordOrStop = function () {
273
- if (isRecordable()) {
274
- if (this.isRecording()) {
275
- this.stop();
276
- } else if (recorder.isReady()) {
277
- this.record();
278
- }
279
- }
280
- };
281
-
282
- this.record = function () {
283
- if (options.video.countdown) {
284
- this.emit(Events.COUNTDOWN);
285
- recorderInsides.startCountdown(recorder.record.bind(recorder));
286
- } else {
287
- recorder.record();
288
- }
289
- };
290
-
291
- this.getRecorder = function () {
292
- return recorder;
293
- };
294
-
295
- this.getReplay = function () {
296
- return replay;
297
- };
298
-
299
- this.validate = function () {
300
- return recorder.validate() && this.isReplayShown();
301
- };
302
-
303
- this.getRecordingStats = function () {
304
- return recorder.getRecordingStats();
305
- };
306
-
307
- this.getAudioSampleRate = function () {
308
- return recorder.getAudioSampleRate();
309
- };
310
-
311
- this.isPaused = function () {
312
- return recorder.isPaused();
313
- };
314
-
315
- this.error = function (err) {
316
- notifier.error(err);
317
- };
318
-
319
- this.hide = function () {
320
- if (visualsElement) {
321
- hidden(visualsElement, true);
322
- this.emit(Events.HIDE);
323
- }
324
- };
325
-
326
- this.isHidden = function () {
327
- if (!built) {
328
- return true;
329
- } else if (visualsElement) {
330
- return hidden(visualsElement);
331
- }
332
- };
333
-
334
- this.showVisuals = function () {
335
- visualsElement && hidden(visualsElement, false);
336
- };
337
-
338
- this.show = function () {
339
- !this.isReplayShown() && visualsElement && recorder.build();
340
- this.showVisuals();
341
- };
342
-
343
- this.showReplayOnly = function () {
344
- !this.isReplayShown() && replay.show();
345
-
346
- this.show();
347
- recorder.hide();
348
- notifier.hide();
349
- };
350
-
351
- this.isRecorderUnloaded = function () {
352
- return recorder.isUnloaded();
353
- };
354
-
355
- this.isConnecting = function () {
356
- return recorder.isConnecting();
357
- };
358
-
359
- this.getRecorderWidth = function (responsive) {
360
- return recorder.getRecorderWidth(responsive);
361
- };
362
-
363
- this.getRecorderHeight = function (responsive, useBoundingClientRect) {
364
- return recorder.getRecorderHeight(responsive, useBoundingClientRect);
365
- };
366
-
367
- this.limitWidth = function (width) {
368
- return container.limitWidth(width, options);
369
- };
370
-
371
- this.limitHeight = function (height) {
372
- return container.limitHeight(height);
373
- };
374
-
375
- this.calculateWidth = function (options) {
376
- return container.calculateWidth(options);
377
- };
378
-
379
- this.calculateHeight = function (options) {
380
- return container.calculateHeight(options);
381
- };
382
-
383
- this.getReplay = function () {
384
- return replay;
385
- };
386
-
387
- this.getBoundingClientRect = function () {
388
- // fixes https://github.com/binarykitchen/videomail-client/issues/126
389
- return visualsElement && visualsElement.getBoundingClientRect();
390
- };
391
-
392
- this.checkTimer = function (intervalSum) {
393
- recorderInsides.checkTimer(intervalSum);
394
- };
395
-
396
- this.isNotifierBuilt = function () {
397
- return notifier && notifier.isBuilt();
398
- };
399
-
400
- this.isReplayShown = replay.isShown.bind(replay);
401
- this.hideReplay = replay.hide.bind(replay);
402
- this.hideRecorder = recorder.hide.bind(recorder);
403
- this.isRecording = recorder.isRecording.bind(recorder);
404
- this.isUserMediaLoaded = recorder.isUserMediaLoaded.bind(recorder);
405
- this.isConnected = recorder.isConnected.bind(recorder);
406
- };
407
-
408
- inherits(Visuals, EventEmitter);
409
-
410
- export default Visuals;
@@ -1 +0,0 @@
1
- module.exports='@-webkit-keyframes blink{0%{opacity:.9}35%{opacity:.9}50%{opacity:.1}85%{opacity:.1}to{opacity:.9}}@keyframes blink{0%{opacity:.9}35%{opacity:.9}50%{opacity:.1}85%{opacity:.1}to{opacity:.9}}.IIV::-webkit-media-controls-play-button,.IIV::-webkit-media-controls-start-playback-button{opacity:0;pointer-events:none;width:5px}.videomail .visuals{position:relative}.videomail .visuals video.replay{height:100%;width:100%}.videomail .countdown,.videomail .pausedHeader,.videomail .pausedHint,.videomail .recordNote,.videomail .recordTimer{height:auto;margin:0}.videomail .countdown,.videomail .facingMode,.videomail .paused,.videomail .recordNote,.videomail .recordTimer,.videomail noscript{position:absolute;z-index:100}.videomail .countdown,.videomail .pausedHeader,.videomail .pausedHint,.videomail .recordNote,.videomail .recordTimer,.videomail noscript{font-weight:700}.videomail .countdown,.videomail .paused,.videomail noscript{top:50%;-webkit-transform:translateY(-50%);-ms-transform:translateY(-50%);transform:translateY(-50%);width:100%}.videomail .countdown,.videomail .pausedHeader,.videomail .pausedHint{letter-spacing:4px;text-align:center;text-shadow:-2px 0 #fff,0 2px #fff,2px 0 #fff,0 -2px #fff}.videomail .countdown,.videomail .pausedHeader{font-size:460%;opacity:.9}.videomail .pausedHint{font-size:150%}.videomail .facingMode{background:rgba(30,30,30,.5);border:none;bottom:.6em;color:hsla(0,0%,96%,.9);font-family:monospace;font-size:1.2em;outline:none;padding:.1em .3em;right:.7em;-webkit-transition:all .2s ease;transition:all .2s ease;z-index:10}.videomail .facingMode:hover{background:rgba(50,50,50,.7);cursor:pointer}.videomail .recordNote,.videomail .recordTimer{background:hsla(0,0%,4%,.8);color:#00d814;font-family:monospace;opacity:.9;padding:.3em .4em;right:.7em;-webkit-transition:all 1s ease;transition:all 1s ease}.videomail .recordNote.near,.videomail .recordTimer.near{color:#eb9369}.videomail .recordNote.nigh,.videomail .recordTimer.nigh{color:#ea4b2a}.videomail .recordTimer{top:.7em}.videomail .recordNote{top:3.6em}.videomail .recordNote:before{-webkit-animation:blink 1s infinite;animation:blink 1s infinite;content:"REC"}.videomail .notifier{-webkit-box-sizing:border-box;box-sizing:border-box;height:100%;overflow:hidden}.videomail .radioGroup{display:block}.videomail video{margin-bottom:0}.videomail video.userMedia{background-color:rgba(50,50,50,.1)}'
@@ -1,16 +0,0 @@
1
- @keyframes blink
2
- 0%
3
- opacity .9
4
-
5
- 35%
6
- opacity .9
7
-
8
- 50%
9
- opacity .1
10
-
11
- 85%
12
- opacity .1
13
-
14
- 100%
15
- opacity .9
16
-
@@ -1,126 +0,0 @@
1
- bright-orange-color = #eb9369
2
- orange-color = #ea4b2a
3
- green-color = #00d814
4
-
5
- @import 'keyframes/*'
6
-
7
- // https://github.com/bfred-it/iphone-inline-video#usage
8
- .IIV::-webkit-media-controls-play-button
9
- .IIV::-webkit-media-controls-start-playback-button
10
- opacity 0
11
- pointer-events none
12
- width 5px
13
-
14
- .videomail
15
-
16
- .visuals
17
- position relative
18
-
19
- video.replay
20
- width 100%
21
- height 100%
22
-
23
- .countdown
24
- .recordTimer
25
- .recordNote
26
- .pausedHeader
27
- .pausedHint
28
- margin 0
29
- height auto
30
-
31
- .countdown
32
- .recordTimer
33
- .recordNote
34
- .paused
35
- .facingMode
36
- noscript
37
- position absolute
38
- z-index 100
39
-
40
- .countdown
41
- .recordTimer
42
- .recordNote
43
- .pausedHeader
44
- .pausedHint
45
- noscript
46
- font-weight bold
47
-
48
- .countdown
49
- .paused
50
- noscript
51
- width 100%
52
- top 50%
53
- transform translateY(-50%)
54
-
55
- .pausedHeader
56
- .pausedHint
57
- .countdown
58
- text-align center
59
- letter-spacing 4px
60
- text-shadow -2px 0 white, 0 2px white, 2px 0 white, 0 -2px white
61
-
62
- .pausedHeader
63
- .countdown
64
- opacity .9
65
- font-size 460%
66
-
67
- .pausedHint
68
- font-size 150%
69
-
70
- .facingMode
71
- right .7em
72
- bottom .6em
73
- background rgba(30, 30, 30, .5)
74
- color rgba(245, 245, 245, .9)
75
- font-family monospace
76
- border none
77
- padding .1em .3em
78
- font-size 1.2em
79
- z-index 10
80
- outline none
81
- transition all .2s ease
82
-
83
- &:hover
84
- background rgba(50, 50, 50, .7)
85
- cursor pointer
86
-
87
-
88
- .recordTimer
89
- .recordNote
90
- right .7em
91
- background rgba(10, 10, 10, .8)
92
- padding .3em .4em
93
- transition all 1s ease
94
- color green-color
95
- font-family monospace
96
- opacity .9
97
-
98
- &.near
99
- color bright-orange-color
100
-
101
- &.nigh
102
- color orange-color
103
-
104
- .recordTimer
105
- top .7em
106
-
107
- .recordNote
108
- top 3.6em
109
-
110
- &:before
111
- content "REC"
112
- animation blink 1s infinite
113
-
114
- .notifier
115
- overflow hidden
116
- box-sizing border-box
117
- height 100%
118
-
119
- .radioGroup
120
- display block
121
-
122
- video
123
- margin-bottom 0
124
-
125
- &.userMedia
126
- background-color rgba(50, 50, 50, .1)