feat(ringoverlay): Change the background when the avatar is displayed
This commit is contained in:
parent
29f0c0b311
commit
dab5252746
|
@ -9,6 +9,11 @@
|
||||||
background: linear-gradient(transparent, #000);
|
background: linear-gradient(transparent, #000);
|
||||||
opacity: 0.8;
|
opacity: 0.8;
|
||||||
|
|
||||||
|
&.solidBG {
|
||||||
|
background: $defaultBackground;
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
|
||||||
&__content {
|
&__content {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
width: 400px;
|
width: 400px;
|
||||||
|
@ -33,4 +38,4 @@
|
||||||
color: #333;
|
color: #333;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,21 @@
|
||||||
/* global $ */
|
/* global $, APP */
|
||||||
/* jshint -W101 */
|
/* jshint -W101 */
|
||||||
|
import UIEvents from "../../../service/UI/UIEvents";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Store the current ring overlay instance.
|
||||||
|
* Note: We want to have only 1 instance at a time.
|
||||||
|
*/
|
||||||
|
let overlay = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handler for UIEvents.LARGE_VIDEO_AVATAR_DISPLAYED event.
|
||||||
|
* @param {boolean} shown indicates whether the avatar on the large video is
|
||||||
|
* currently displayed or not.
|
||||||
|
*/
|
||||||
|
function onAvatarDisplayed(shown) {
|
||||||
|
overlay._changeBackground(shown);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Shows ring overlay
|
* Shows ring overlay
|
||||||
|
@ -19,6 +35,21 @@ class RingOverlay {
|
||||||
this._setAudioTimeout();
|
this._setAudioTimeout();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Chagnes the background of the ring overlay.
|
||||||
|
* @param {boolean} solid - if true the new background will be the solid
|
||||||
|
* one, otherwise the background will be default one.
|
||||||
|
* NOTE: The method just toggles solidBG css class.
|
||||||
|
*/
|
||||||
|
_changeBackground(solid) {
|
||||||
|
const container = $("#" + this._containerId);
|
||||||
|
if(solid) {
|
||||||
|
container.addClass("solidBG");
|
||||||
|
} else {
|
||||||
|
container.removeClass("solidBG");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Builds and appends the ring overlay to the html document
|
* Builds and appends the ring overlay to the html document
|
||||||
*/
|
*/
|
||||||
|
@ -74,12 +105,6 @@ class RingOverlay {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Store the current ring overlay instance.
|
|
||||||
* Note: We want to have only 1 instance at a time.
|
|
||||||
*/
|
|
||||||
let overlay = null;
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
/**
|
/**
|
||||||
* Shows the ring overlay for the passed callee.
|
* Shows the ring overlay for the passed callee.
|
||||||
|
@ -92,6 +117,8 @@ export default {
|
||||||
}
|
}
|
||||||
|
|
||||||
overlay = new RingOverlay(callee);
|
overlay = new RingOverlay(callee);
|
||||||
|
APP.UI.addListener(UIEvents.LARGE_VIDEO_AVATAR_DISPLAYED,
|
||||||
|
onAvatarDisplayed);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -104,6 +131,8 @@ export default {
|
||||||
}
|
}
|
||||||
overlay.destroy();
|
overlay.destroy();
|
||||||
overlay = null;
|
overlay = null;
|
||||||
|
APP.UI.removeListener(UIEvents.LARGE_VIDEO_AVATAR_DISPLAYED,
|
||||||
|
onAvatarDisplayed);
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -164,11 +164,12 @@ class VideoContainer extends LargeContainer {
|
||||||
return getStreamOwnerId(this.stream);
|
return getStreamOwnerId(this.stream);
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor (onPlay) {
|
constructor (onPlay, emitter) {
|
||||||
super();
|
super();
|
||||||
this.stream = null;
|
this.stream = null;
|
||||||
this.videoType = null;
|
this.videoType = null;
|
||||||
this.localFlipX = true;
|
this.localFlipX = true;
|
||||||
|
this.emitter = emitter;
|
||||||
|
|
||||||
this.isVisible = false;
|
this.isVisible = false;
|
||||||
|
|
||||||
|
@ -327,6 +328,8 @@ class VideoContainer extends LargeContainer {
|
||||||
(show) ? interfaceConfig.DEFAULT_BACKGROUND : "#000");
|
(show) ? interfaceConfig.DEFAULT_BACKGROUND : "#000");
|
||||||
|
|
||||||
this.$avatar.css("visibility", show ? "visible" : "hidden");
|
this.$avatar.css("visibility", show ? "visible" : "hidden");
|
||||||
|
|
||||||
|
this.emitter.emit(UIEvents.LARGE_VIDEO_AVATAR_DISPLAYED, show);
|
||||||
}
|
}
|
||||||
|
|
||||||
// We are doing fadeOut/fadeIn animations on parent div which wraps
|
// We are doing fadeOut/fadeIn animations on parent div which wraps
|
||||||
|
@ -385,12 +388,12 @@ class VideoContainer extends LargeContainer {
|
||||||
* Manager for all Large containers.
|
* Manager for all Large containers.
|
||||||
*/
|
*/
|
||||||
export default class LargeVideoManager {
|
export default class LargeVideoManager {
|
||||||
constructor () {
|
constructor (emitter) {
|
||||||
this.containers = {};
|
this.containers = {};
|
||||||
|
|
||||||
this.state = VIDEO_CONTAINER_TYPE;
|
this.state = VIDEO_CONTAINER_TYPE;
|
||||||
this.videoContainer = new VideoContainer(
|
this.videoContainer = new VideoContainer(
|
||||||
() => this.resizeContainer(VIDEO_CONTAINER_TYPE));
|
() => this.resizeContainer(VIDEO_CONTAINER_TYPE), emitter);
|
||||||
this.addContainer(VIDEO_CONTAINER_TYPE, this.videoContainer);
|
this.addContainer(VIDEO_CONTAINER_TYPE, this.videoContainer);
|
||||||
|
|
||||||
// use the same video container to handle and desktop tracks
|
// use the same video container to handle and desktop tracks
|
||||||
|
|
|
@ -113,7 +113,7 @@ var VideoLayout = {
|
||||||
},
|
},
|
||||||
|
|
||||||
initLargeVideo () {
|
initLargeVideo () {
|
||||||
largeVideo = new LargeVideoManager();
|
largeVideo = new LargeVideoManager(eventEmitter);
|
||||||
if(localFlipX) {
|
if(localFlipX) {
|
||||||
largeVideo.onLocalFlipXChange(localFlipX);
|
largeVideo.onLocalFlipXChange(localFlipX);
|
||||||
}
|
}
|
||||||
|
|
|
@ -105,5 +105,10 @@ export default {
|
||||||
* event must contain the identifier of the container that has been toggled
|
* event must contain the identifier of the container that has been toggled
|
||||||
* and information about toggle on or off.
|
* and information about toggle on or off.
|
||||||
*/
|
*/
|
||||||
SIDE_TOOLBAR_CONTAINER_TOGGLED: "UI.side_container_toggled"
|
SIDE_TOOLBAR_CONTAINER_TOGGLED: "UI.side_container_toggled",
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notifies that the avatar is displayed or not on the largeVideo.
|
||||||
|
*/
|
||||||
|
LARGE_VIDEO_AVATAR_DISPLAYED: "UI.large_video_avatar_displayed"
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue