Merge pull request #995 from jitsi/ring_overlay_disable_ringing
Add interfaceConfig option for disabling ringing
This commit is contained in:
commit
688e71cd1b
|
@ -43,6 +43,8 @@ var interfaceConfig = { // eslint-disable-line no-unused-vars
|
|||
ENABLE_FEEDBACK_ANIMATION: false,
|
||||
DISABLE_FOCUS_INDICATOR: false,
|
||||
DISABLE_DOMINANT_SPEAKER_INDICATOR: false,
|
||||
// disables the ringing sound when the RingOverlay is shown.
|
||||
DISABLE_RINGING: false,
|
||||
AUDIO_LEVEL_PRIMARY_COLOR: "rgba(255,255,255,0.7)",
|
||||
AUDIO_LEVEL_SECONDARY_COLOR: "rgba(255,255,255,0.4)"
|
||||
};
|
||||
|
|
|
@ -525,7 +525,7 @@ UI.start = function () {
|
|||
}
|
||||
|
||||
if(APP.tokenData.callee) {
|
||||
UI.showRingOverLay();
|
||||
UI.showRingOverlay();
|
||||
}
|
||||
|
||||
// Return true to indicate that the UI has been fully started and
|
||||
|
@ -1472,8 +1472,8 @@ UI.setMicrophoneButtonEnabled = function (enabled) {
|
|||
Toolbar.setAudioIconEnabled(enabled);
|
||||
};
|
||||
|
||||
UI.showRingOverLay = function () {
|
||||
RingOverlay.show(APP.tokenData.callee);
|
||||
UI.showRingOverlay = function () {
|
||||
RingOverlay.show(APP.tokenData.callee, interfaceConfig.DISABLE_RINGING);
|
||||
FilmStrip.toggleFilmStrip(false);
|
||||
};
|
||||
|
||||
|
|
|
@ -23,22 +23,32 @@ function onAvatarDisplayed(shown) {
|
|||
class RingOverlay {
|
||||
/**
|
||||
* @param callee instance of User class from TokenData.js
|
||||
* @param {boolean} disableRingingSound if true the ringing sound wont be played.
|
||||
*/
|
||||
constructor(callee) {
|
||||
constructor(callee, disableRingingSound) {
|
||||
this._containerId = 'ringOverlay';
|
||||
this._audioContainerId = 'ringOverlayRinging';
|
||||
this.isRinging = true;
|
||||
this.callee = callee;
|
||||
this.disableRingingSound = disableRingingSound;
|
||||
this.render();
|
||||
this.audio = document.getElementById(this._audioContainerId);
|
||||
this.audio.play();
|
||||
this._setAudioTimeout();
|
||||
if(!disableRingingSound)
|
||||
this._initAudio();
|
||||
this._timeout = setTimeout(() => {
|
||||
this.destroy();
|
||||
this.render();
|
||||
}, 30000);
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes the audio element and setups the interval for playing it.
|
||||
*/
|
||||
_initAudio() {
|
||||
this.audio = document.getElementById(this._audioContainerId);
|
||||
this.audio.play();
|
||||
this._setAudioTimeout();
|
||||
}
|
||||
|
||||
/**
|
||||
* Chagnes the background of the ring overlay.
|
||||
* @param {boolean} solid - if true the new background will be the solid
|
||||
|
@ -58,8 +68,11 @@ class RingOverlay {
|
|||
* Builds and appends the ring overlay to the html document
|
||||
*/
|
||||
_getHtmlStr(callee) {
|
||||
let callingLabel = this.isRinging? "<p>Calling...</p>" : "";
|
||||
let callerStateLabel = this.isRinging? "" : " isn't available";
|
||||
let callingLabel = this.isRinging ? "<p>Calling...</p>" : "";
|
||||
let callerStateLabel = this.isRinging ? "" : " isn't available";
|
||||
let audioHTML = this.disableRingingSound ? ""
|
||||
: "<audio id=\"" + this._audioContainerId
|
||||
+ "\" src=\"./sounds/ring.ogg\" />";
|
||||
return `
|
||||
<div id="${this._containerId}" class='ringing' >
|
||||
<div class='ringing__content'>
|
||||
|
@ -69,7 +82,7 @@ class RingOverlay {
|
|||
<p>${callee.getName()}${callerStateLabel}</p>
|
||||
</div>
|
||||
</div>
|
||||
<audio id="${this._audioContainerId}" src="./sounds/ring.ogg" />
|
||||
${audioHTML}
|
||||
</div>`;
|
||||
}
|
||||
|
||||
|
@ -86,6 +99,7 @@ class RingOverlay {
|
|||
* related to the ring overlay.
|
||||
*/
|
||||
destroy() {
|
||||
this.isRinging = false;
|
||||
this._stopAudio();
|
||||
this._detach();
|
||||
}
|
||||
|
@ -99,7 +113,6 @@ class RingOverlay {
|
|||
}
|
||||
|
||||
_stopAudio() {
|
||||
this.isRinging = false;
|
||||
if (this.interval) {
|
||||
clearInterval(this.interval);
|
||||
}
|
||||
|
@ -123,13 +136,14 @@ export default {
|
|||
* Shows the ring overlay for the passed callee.
|
||||
* @param callee {class User} the callee. Instance of User class from
|
||||
* TokenData.js
|
||||
* @param {boolean} disableRingingSound if true the ringing sound wont be played.
|
||||
*/
|
||||
show(callee) {
|
||||
show(callee, disableRingingSound = false) {
|
||||
if(overlay) {
|
||||
this.hide();
|
||||
}
|
||||
|
||||
overlay = new RingOverlay(callee);
|
||||
overlay = new RingOverlay(callee, disableRingingSound);
|
||||
APP.UI.addListener(UIEvents.LARGE_VIDEO_AVATAR_DISPLAYED,
|
||||
onAvatarDisplayed);
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue