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,59 +0,0 @@
|
|
|
1
|
-
import h from "hyperscript";
|
|
2
|
-
import hidden from "hidden";
|
|
3
|
-
|
|
4
|
-
import VideomailError from "./../../../../util/videomailError";
|
|
5
|
-
|
|
6
|
-
export default function (visuals, options) {
|
|
7
|
-
if (!options.text.pausedHeader) {
|
|
8
|
-
throw VideomailError.create("Paused header cannot be empty", options);
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
let pausedBlockElement;
|
|
12
|
-
let pausedHeaderElement;
|
|
13
|
-
let pausedHintElement;
|
|
14
|
-
|
|
15
|
-
function hasPausedHint() {
|
|
16
|
-
return options.text.pausedHint;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
this.build = function () {
|
|
20
|
-
pausedBlockElement = visuals.querySelector(".paused");
|
|
21
|
-
pausedHeaderElement = visuals.querySelector(".pausedHeader");
|
|
22
|
-
|
|
23
|
-
if (!pausedHeaderElement) {
|
|
24
|
-
pausedBlockElement = h("div.paused");
|
|
25
|
-
pausedHeaderElement = h("p.pausedHeader");
|
|
26
|
-
|
|
27
|
-
this.hide();
|
|
28
|
-
|
|
29
|
-
pausedHeaderElement.innerHTML = options.text.pausedHeader;
|
|
30
|
-
|
|
31
|
-
pausedBlockElement.appendChild(pausedHeaderElement);
|
|
32
|
-
|
|
33
|
-
if (hasPausedHint()) {
|
|
34
|
-
pausedHintElement = visuals.querySelector(".pausedHint");
|
|
35
|
-
pausedHintElement = h("p.pausedHint");
|
|
36
|
-
pausedHintElement.innerHTML = options.text.pausedHint;
|
|
37
|
-
pausedBlockElement.appendChild(pausedHintElement);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
visuals.appendChild(pausedBlockElement);
|
|
41
|
-
} else {
|
|
42
|
-
this.hide();
|
|
43
|
-
|
|
44
|
-
pausedHeaderElement.innerHTML = options.text.pausedHeader;
|
|
45
|
-
|
|
46
|
-
if (hasPausedHint()) {
|
|
47
|
-
pausedHintElement.innerHTML = options.text.pausedHint;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
this.hide = function () {
|
|
53
|
-
hidden(pausedBlockElement, true);
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
this.show = function () {
|
|
57
|
-
hidden(pausedBlockElement, false);
|
|
58
|
-
};
|
|
59
|
-
}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import h from "hyperscript";
|
|
2
|
-
import hidden from "hidden";
|
|
3
|
-
|
|
4
|
-
export default function (visuals) {
|
|
5
|
-
let recordNoteElement;
|
|
6
|
-
|
|
7
|
-
this.build = function () {
|
|
8
|
-
recordNoteElement = visuals.querySelector(".recordNote");
|
|
9
|
-
|
|
10
|
-
if (!recordNoteElement) {
|
|
11
|
-
recordNoteElement = h("p.recordNote");
|
|
12
|
-
|
|
13
|
-
this.hide();
|
|
14
|
-
|
|
15
|
-
visuals.appendChild(recordNoteElement);
|
|
16
|
-
} else {
|
|
17
|
-
this.hide();
|
|
18
|
-
}
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
this.stop = function () {
|
|
22
|
-
this.hide();
|
|
23
|
-
recordNoteElement.classList.remove("near");
|
|
24
|
-
recordNoteElement.classList.remove("nigh");
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
this.setNear = function () {
|
|
28
|
-
recordNoteElement.classList.add("near");
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
this.setNigh = function () {
|
|
32
|
-
recordNoteElement.classList.add("nigh");
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
this.hide = function () {
|
|
36
|
-
hidden(recordNoteElement, true);
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
this.show = function () {
|
|
40
|
-
hidden(recordNoteElement, false);
|
|
41
|
-
};
|
|
42
|
-
}
|
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
import h from "hyperscript";
|
|
2
|
-
import hidden from "hidden";
|
|
3
|
-
|
|
4
|
-
export default function (visuals, recordNote, options) {
|
|
5
|
-
let recordTimerElement;
|
|
6
|
-
|
|
7
|
-
let nearComputed = false;
|
|
8
|
-
let endNighComputed = false;
|
|
9
|
-
|
|
10
|
-
let started;
|
|
11
|
-
let countdown;
|
|
12
|
-
|
|
13
|
-
function pad(n) {
|
|
14
|
-
return n < 10 ? `0${n}` : n;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
function thresholdReached(secs, threshold) {
|
|
18
|
-
return secs >= options.video.limitSeconds * threshold;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
function isNear(secs) {
|
|
22
|
-
if (!nearComputed && thresholdReached(secs, 0.6)) {
|
|
23
|
-
nearComputed = true;
|
|
24
|
-
return true;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
return false;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
function endIsNigh(secs) {
|
|
31
|
-
if (!endNighComputed && thresholdReached(secs, 0.8)) {
|
|
32
|
-
endNighComputed = true;
|
|
33
|
-
return true;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
return false;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
function setNear() {
|
|
40
|
-
recordTimerElement.classList.add("near");
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
function setNigh() {
|
|
44
|
-
recordTimerElement.classList.add("nigh");
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
this.check = function (opts) {
|
|
48
|
-
const newCountdown = getStartSeconds() - Math.floor(opts.intervalSum / 1e3);
|
|
49
|
-
|
|
50
|
-
// performance optimisation (another reason we need react here!)
|
|
51
|
-
if (newCountdown !== countdown) {
|
|
52
|
-
countdown = newCountdown;
|
|
53
|
-
update();
|
|
54
|
-
countdown < 1 && visuals.stop(true);
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
function update() {
|
|
59
|
-
const mins = parseInt(countdown / 60, 10);
|
|
60
|
-
const secs = countdown - mins * 60;
|
|
61
|
-
|
|
62
|
-
if (!nearComputed || !endNighComputed) {
|
|
63
|
-
const remainingSeconds = options.video.limitSeconds - countdown;
|
|
64
|
-
|
|
65
|
-
if (isNear(remainingSeconds)) {
|
|
66
|
-
recordNote.setNear();
|
|
67
|
-
setNear();
|
|
68
|
-
|
|
69
|
-
options.debug(`End is near, ${countdown} seconds to go`);
|
|
70
|
-
} else if (endIsNigh(remainingSeconds)) {
|
|
71
|
-
recordNote.setNigh();
|
|
72
|
-
setNigh();
|
|
73
|
-
|
|
74
|
-
options.debug(`End is nigh, ${countdown} seconds to go`);
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
recordTimerElement.innerHTML = `${mins}:${pad(secs)}`;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
function hide() {
|
|
82
|
-
hidden(recordTimerElement, true);
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
function show() {
|
|
86
|
-
recordTimerElement.classList.remove("near");
|
|
87
|
-
recordTimerElement.classList.remove("nigh");
|
|
88
|
-
|
|
89
|
-
hidden(recordTimerElement, false);
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
function getSecondsRecorded() {
|
|
93
|
-
return getStartSeconds() - countdown;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
function getStartSeconds() {
|
|
97
|
-
return options.video.limitSeconds;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
this.start = function () {
|
|
101
|
-
countdown = getStartSeconds();
|
|
102
|
-
nearComputed = endNighComputed = false;
|
|
103
|
-
started = true;
|
|
104
|
-
|
|
105
|
-
update();
|
|
106
|
-
|
|
107
|
-
show();
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
this.pause = function () {
|
|
111
|
-
recordNote.hide();
|
|
112
|
-
};
|
|
113
|
-
|
|
114
|
-
this.resume = function () {
|
|
115
|
-
recordNote.show();
|
|
116
|
-
};
|
|
117
|
-
|
|
118
|
-
function isStopped() {
|
|
119
|
-
return countdown === null;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
this.stop = function () {
|
|
123
|
-
if (!isStopped() && started) {
|
|
124
|
-
options.debug(
|
|
125
|
-
`Stopping record timer. Was recording for about ~${getSecondsRecorded()} seconds.`,
|
|
126
|
-
);
|
|
127
|
-
|
|
128
|
-
hide();
|
|
129
|
-
recordNote.stop();
|
|
130
|
-
|
|
131
|
-
countdown = null;
|
|
132
|
-
started = false;
|
|
133
|
-
}
|
|
134
|
-
};
|
|
135
|
-
|
|
136
|
-
this.build = function () {
|
|
137
|
-
recordTimerElement = visuals.querySelector(".recordTimer");
|
|
138
|
-
|
|
139
|
-
if (!recordTimerElement) {
|
|
140
|
-
recordTimerElement = h("p.recordTimer");
|
|
141
|
-
|
|
142
|
-
hide();
|
|
143
|
-
|
|
144
|
-
visuals.appendChild(recordTimerElement);
|
|
145
|
-
} else {
|
|
146
|
-
hide();
|
|
147
|
-
}
|
|
148
|
-
};
|
|
149
|
-
}
|
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
import inherits from "inherits";
|
|
2
|
-
|
|
3
|
-
import Events from "./../../../events";
|
|
4
|
-
import EventEmitter from "./../../../util/eventEmitter";
|
|
5
|
-
import Browser from "./../../../util/browser";
|
|
6
|
-
|
|
7
|
-
import Countdown from "./recorder/countdown";
|
|
8
|
-
import PausedNote from "./recorder/pausedNote";
|
|
9
|
-
import RecordNote from "./recorder/recordNote";
|
|
10
|
-
import RecordTimer from "./recorder/recordTimer";
|
|
11
|
-
import FacingMode from "./recorder/facingMode";
|
|
12
|
-
|
|
13
|
-
const RecorderInsides = function (visuals, options) {
|
|
14
|
-
EventEmitter.call(this, options, "RecorderInsides");
|
|
15
|
-
|
|
16
|
-
const self = this;
|
|
17
|
-
const { debug } = options;
|
|
18
|
-
|
|
19
|
-
const recordNote = new RecordNote(visuals);
|
|
20
|
-
const recordTimer = new RecordTimer(visuals, recordNote, options);
|
|
21
|
-
const browser = new Browser(options);
|
|
22
|
-
|
|
23
|
-
let countdown;
|
|
24
|
-
let pausedNote;
|
|
25
|
-
let built;
|
|
26
|
-
let facingMode;
|
|
27
|
-
|
|
28
|
-
if (options.video.countdown) {
|
|
29
|
-
countdown = new Countdown(visuals, options);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
if (options.video.facingModeButton && browser.isMobile()) {
|
|
33
|
-
facingMode = new FacingMode(visuals, options);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
if (options.enablePause) {
|
|
37
|
-
pausedNote = new PausedNote(visuals, options);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
function startRecording() {
|
|
41
|
-
recordTimer.start();
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
function resumeRecording() {
|
|
45
|
-
recordTimer.resume();
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
function stopRecording() {
|
|
49
|
-
recordTimer.stop();
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
function pauseRecording() {
|
|
53
|
-
if (self.isCountingDown()) {
|
|
54
|
-
countdown.pause();
|
|
55
|
-
} else {
|
|
56
|
-
recordTimer.pause();
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
function onResetting() {
|
|
61
|
-
self.hidePause();
|
|
62
|
-
self.hideCountdown();
|
|
63
|
-
recordTimer.stop();
|
|
64
|
-
facingMode && facingMode.hide();
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
function initEvents() {
|
|
68
|
-
debug("RecorderInsides: initEvents()");
|
|
69
|
-
|
|
70
|
-
self
|
|
71
|
-
.on(Events.USER_MEDIA_READY, function () {
|
|
72
|
-
facingMode && facingMode.show();
|
|
73
|
-
})
|
|
74
|
-
.on(Events.RECORDING, function () {
|
|
75
|
-
startRecording();
|
|
76
|
-
})
|
|
77
|
-
.on(Events.RESUMING, function () {
|
|
78
|
-
resumeRecording();
|
|
79
|
-
})
|
|
80
|
-
.on(Events.STOPPING, function () {
|
|
81
|
-
stopRecording();
|
|
82
|
-
})
|
|
83
|
-
.on(Events.PAUSED, function () {
|
|
84
|
-
pauseRecording();
|
|
85
|
-
})
|
|
86
|
-
.on(Events.RESETTING, onResetting)
|
|
87
|
-
.on(Events.HIDE, function () {
|
|
88
|
-
self.hideCountdown();
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
this.build = function () {
|
|
93
|
-
debug("RecorderInsides: build()");
|
|
94
|
-
|
|
95
|
-
countdown && countdown.build();
|
|
96
|
-
pausedNote && pausedNote.build();
|
|
97
|
-
facingMode && facingMode.build();
|
|
98
|
-
|
|
99
|
-
recordNote.build();
|
|
100
|
-
recordTimer.build();
|
|
101
|
-
|
|
102
|
-
!built && initEvents();
|
|
103
|
-
|
|
104
|
-
built = true;
|
|
105
|
-
};
|
|
106
|
-
|
|
107
|
-
this.unload = function () {
|
|
108
|
-
countdown && countdown.unload();
|
|
109
|
-
|
|
110
|
-
built = false;
|
|
111
|
-
};
|
|
112
|
-
|
|
113
|
-
this.showPause = function () {
|
|
114
|
-
pausedNote && pausedNote.show();
|
|
115
|
-
};
|
|
116
|
-
|
|
117
|
-
this.hidePause = function () {
|
|
118
|
-
pausedNote && pausedNote.hide();
|
|
119
|
-
};
|
|
120
|
-
|
|
121
|
-
this.hideCountdown = function () {
|
|
122
|
-
countdown && countdown.hide();
|
|
123
|
-
};
|
|
124
|
-
|
|
125
|
-
this.startCountdown = function (cb) {
|
|
126
|
-
countdown && countdown.start(cb);
|
|
127
|
-
};
|
|
128
|
-
|
|
129
|
-
this.resumeCountdown = function () {
|
|
130
|
-
countdown && countdown.resume();
|
|
131
|
-
};
|
|
132
|
-
|
|
133
|
-
this.isCountingDown = function () {
|
|
134
|
-
return countdown && countdown.isCountingDown();
|
|
135
|
-
};
|
|
136
|
-
|
|
137
|
-
this.checkTimer = function (intervalSum) {
|
|
138
|
-
recordTimer.check(intervalSum);
|
|
139
|
-
};
|
|
140
|
-
};
|
|
141
|
-
|
|
142
|
-
inherits(RecorderInsides, EventEmitter);
|
|
143
|
-
|
|
144
|
-
export default RecorderInsides;
|