|
@@ -1,5 +1,5 @@
|
1
|
1
|
/* global $, APP */
|
2
|
|
-/* jshint -W101 */
|
|
2
|
+
|
3
|
3
|
import UIEvents from "../../../service/UI/UIEvents";
|
4
|
4
|
|
5
|
5
|
/**
|
|
@@ -24,21 +24,24 @@ class RingOverlay {
|
24
|
24
|
/**
|
25
|
25
|
*
|
26
|
26
|
* @param callee The callee (Object) as defined by the JWT support.
|
27
|
|
- * @param {boolean} disableRingingSound if true the ringing sound wont be played.
|
|
27
|
+ * @param {boolean} disableRinging if true the ringing sound wont be played.
|
28
|
28
|
*/
|
29
|
|
- constructor(callee, disableRingingSound) {
|
|
29
|
+ constructor(callee, disableRinging) {
|
30
|
30
|
this._containerId = 'ringOverlay';
|
31
|
31
|
this._audioContainerId = 'ringOverlayRinging';
|
32
|
32
|
this.isRinging = true;
|
33
|
33
|
this.callee = callee;
|
34
|
|
- this.disableRingingSound = disableRingingSound;
|
|
34
|
+ this.disableRinging = disableRinging;
|
35
|
35
|
this.render();
|
36
|
|
- if(!disableRingingSound)
|
|
36
|
+ if (!disableRinging)
|
37
|
37
|
this._initAudio();
|
38
|
|
- this._timeout = setTimeout(() => {
|
39
|
|
- this.destroy();
|
40
|
|
- this.render();
|
41
|
|
- }, 30000);
|
|
38
|
+ this._timeout
|
|
39
|
+ = setTimeout(
|
|
40
|
+ () => {
|
|
41
|
+ this.destroy();
|
|
42
|
+ this.render();
|
|
43
|
+ },
|
|
44
|
+ 30000);
|
42
|
45
|
}
|
43
|
46
|
|
44
|
47
|
/**
|
|
@@ -47,7 +50,7 @@ class RingOverlay {
|
47
|
50
|
_initAudio() {
|
48
|
51
|
this.audio = document.getElementById(this._audioContainerId);
|
49
|
52
|
this.audio.play();
|
50
|
|
- this._setAudioTimeout();
|
|
53
|
+ this.interval = setInterval(() => this.audio.play(), 5000);
|
51
|
54
|
}
|
52
|
55
|
|
53
|
56
|
/**
|
|
@@ -58,7 +61,8 @@ class RingOverlay {
|
58
|
61
|
*/
|
59
|
62
|
_changeBackground(solid) {
|
60
|
63
|
const container = $("#" + this._containerId);
|
61
|
|
- if(solid) {
|
|
64
|
+
|
|
65
|
+ if (solid) {
|
62
|
66
|
container.addClass("solidBG");
|
63
|
67
|
} else {
|
64
|
68
|
container.removeClass("solidBG");
|
|
@@ -71,9 +75,10 @@ class RingOverlay {
|
71
|
75
|
_getHtmlStr(callee) {
|
72
|
76
|
let callingLabel = this.isRinging ? "<p>Calling...</p>" : "";
|
73
|
77
|
let callerStateLabel = this.isRinging ? "" : " isn't available";
|
74
|
|
- let audioHTML = this.disableRingingSound ? ""
|
|
78
|
+ let audioHTML = this.disableRinging ? ""
|
75
|
79
|
: "<audio id=\"" + this._audioContainerId
|
76
|
80
|
+ "\" src=\"./sounds/ring.ogg\" />";
|
|
81
|
+
|
77
|
82
|
return `
|
78
|
83
|
<div id="${this._containerId}" class='ringing' >
|
79
|
84
|
<div class='ringing__content'>
|
|
@@ -120,19 +125,10 @@ class RingOverlay {
|
120
|
125
|
if (this.interval) {
|
121
|
126
|
clearInterval(this.interval);
|
122
|
127
|
}
|
123
|
|
- if(this._timeout) {
|
|
128
|
+ if (this._timeout) {
|
124
|
129
|
clearTimeout(this._timeout);
|
125
|
130
|
}
|
126
|
131
|
}
|
127
|
|
-
|
128
|
|
- /**
|
129
|
|
- * Sets the interval that is going to play the ringing sound.
|
130
|
|
- */
|
131
|
|
- _setAudioTimeout() {
|
132
|
|
- this.interval = setInterval( () => {
|
133
|
|
- this.audio.play();
|
134
|
|
- }, 5000);
|
135
|
|
- }
|
136
|
132
|
}
|
137
|
133
|
|
138
|
134
|
export default {
|
|
@@ -141,16 +137,16 @@ export default {
|
141
|
137
|
*
|
142
|
138
|
* @param {Object} callee - The callee. Object containing data about
|
143
|
139
|
* callee.
|
144
|
|
- * @param {boolean} disableRingingSound - If true the ringing sound won't be
|
|
140
|
+ * @param {boolean} disableRinging - If true the ringing sound won't be
|
145
|
141
|
* played.
|
146
|
142
|
* @returns {void}
|
147
|
143
|
*/
|
148
|
|
- show(callee, disableRingingSound = false) {
|
149
|
|
- if(overlay) {
|
|
144
|
+ show(callee, disableRinging = false) {
|
|
145
|
+ if (overlay) {
|
150
|
146
|
this.hide();
|
151
|
147
|
}
|
152
|
148
|
|
153
|
|
- overlay = new RingOverlay(callee, disableRingingSound);
|
|
149
|
+ overlay = new RingOverlay(callee, disableRinging);
|
154
|
150
|
APP.UI.addListener(UIEvents.LARGE_VIDEO_AVATAR_VISIBLE,
|
155
|
151
|
onAvatarVisible);
|
156
|
152
|
},
|
|
@@ -160,7 +156,7 @@ export default {
|
160
|
156
|
* overlay.
|
161
|
157
|
*/
|
162
|
158
|
hide() {
|
163
|
|
- if(!overlay) {
|
|
159
|
+ if (!overlay) {
|
164
|
160
|
return false;
|
165
|
161
|
}
|
166
|
162
|
overlay.destroy();
|
|
@@ -176,7 +172,7 @@ export default {
|
176
|
172
|
* @returns {boolean} true if the ring overlay is currently displayed or
|
177
|
173
|
* false otherwise.
|
178
|
174
|
*/
|
179
|
|
- isVisible () {
|
|
175
|
+ isVisible() {
|
180
|
176
|
return overlay !== null;
|
181
|
177
|
}
|
182
|
178
|
};
|