Browse Source

feat(ringoverlay): Change the background when the avatar is displayed

j8
hristoterezov 8 years ago
parent
commit
dab5252746

+ 6
- 1
css/ringing/_ringing.scss View File

9
     background: linear-gradient(transparent, #000);
9
     background: linear-gradient(transparent, #000);
10
     opacity: 0.8;
10
     opacity: 0.8;
11
 
11
 
12
+    &.solidBG {
13
+        background: $defaultBackground;
14
+        opacity: 1;
15
+    }
16
+
12
     &__content {
17
     &__content {
13
         position: absolute;
18
         position: absolute;
14
         width: 400px;
19
         width: 400px;
33
             color: #333;
38
             color: #333;
34
         }
39
         }
35
     }
40
     }
36
-}
41
+}

+ 36
- 7
modules/UI/ring_overlay/RingOverlay.js View File

1
-/* global $ */
1
+/* global $, APP */
2
 /* jshint -W101 */
2
 /* jshint -W101 */
3
+import UIEvents from "../../../service/UI/UIEvents";
4
+
5
+/**
6
+ * Store the current ring overlay instance.
7
+ * Note: We want to have only 1 instance at a time.
8
+ */
9
+let overlay = null;
10
+
11
+/**
12
+ * Handler for UIEvents.LARGE_VIDEO_AVATAR_DISPLAYED event.
13
+ * @param {boolean} shown indicates whether the avatar on the large video is
14
+ *  currently displayed or not.
15
+ */
16
+function onAvatarDisplayed(shown) {
17
+    overlay._changeBackground(shown);
18
+}
3
 
19
 
4
 /**
20
 /**
5
  * Shows ring overlay
21
  * Shows ring overlay
19
         this._setAudioTimeout();
35
         this._setAudioTimeout();
20
     }
36
     }
21
 
37
 
38
+    /**
39
+     * Chagnes the background of the ring overlay.
40
+     * @param {boolean} solid - if true the new background will be the solid
41
+     * one, otherwise the background will be default one.
42
+     * NOTE: The method just toggles solidBG css class.
43
+     */
44
+    _changeBackground(solid) {
45
+        const container = $("#" + this._containerId);
46
+        if(solid) {
47
+            container.addClass("solidBG");
48
+        } else {
49
+            container.removeClass("solidBG");
50
+        }
51
+    }
52
+
22
     /**
53
     /**
23
      * Builds and appends the ring overlay to the html document
54
      * Builds and appends the ring overlay to the html document
24
      */
55
      */
74
     }
105
     }
75
 }
106
 }
76
 
107
 
77
-/**
78
- * Store the current ring overlay instance.
79
- * Note: We want to have only 1 instance at a time.
80
- */
81
-let overlay = null;
82
-
83
 export default {
108
 export default {
84
     /**
109
     /**
85
      * Shows the ring overlay for the passed callee.
110
      * Shows the ring overlay for the passed callee.
92
         }
117
         }
93
 
118
 
94
         overlay = new RingOverlay(callee);
119
         overlay = new RingOverlay(callee);
120
+        APP.UI.addListener(UIEvents.LARGE_VIDEO_AVATAR_DISPLAYED,
121
+            onAvatarDisplayed);
95
     },
122
     },
96
 
123
 
97
     /**
124
     /**
104
         }
131
         }
105
         overlay.destroy();
132
         overlay.destroy();
106
         overlay = null;
133
         overlay = null;
134
+        APP.UI.removeListener(UIEvents.LARGE_VIDEO_AVATAR_DISPLAYED,
135
+            onAvatarDisplayed);
107
         return true;
136
         return true;
108
     },
137
     },
109
 
138
 

+ 6
- 3
modules/UI/videolayout/LargeVideo.js View File

164
         return getStreamOwnerId(this.stream);
164
         return getStreamOwnerId(this.stream);
165
     }
165
     }
166
 
166
 
167
-    constructor (onPlay) {
167
+    constructor (onPlay, emitter) {
168
         super();
168
         super();
169
         this.stream = null;
169
         this.stream = null;
170
         this.videoType = null;
170
         this.videoType = null;
171
         this.localFlipX = true;
171
         this.localFlipX = true;
172
+        this.emitter = emitter;
172
 
173
 
173
         this.isVisible = false;
174
         this.isVisible = false;
174
 
175
 
327
             (show) ? interfaceConfig.DEFAULT_BACKGROUND : "#000");
328
             (show) ? interfaceConfig.DEFAULT_BACKGROUND : "#000");
328
 
329
 
329
         this.$avatar.css("visibility", show ? "visible" : "hidden");
330
         this.$avatar.css("visibility", show ? "visible" : "hidden");
331
+
332
+        this.emitter.emit(UIEvents.LARGE_VIDEO_AVATAR_DISPLAYED, show);
330
     }
333
     }
331
 
334
 
332
     // We are doing fadeOut/fadeIn animations on parent div which wraps
335
     // We are doing fadeOut/fadeIn animations on parent div which wraps
385
  * Manager for all Large containers.
388
  * Manager for all Large containers.
386
  */
389
  */
387
 export default class LargeVideoManager {
390
 export default class LargeVideoManager {
388
-    constructor () {
391
+    constructor (emitter) {
389
         this.containers = {};
392
         this.containers = {};
390
 
393
 
391
         this.state = VIDEO_CONTAINER_TYPE;
394
         this.state = VIDEO_CONTAINER_TYPE;
392
         this.videoContainer = new VideoContainer(
395
         this.videoContainer = new VideoContainer(
393
-            () => this.resizeContainer(VIDEO_CONTAINER_TYPE));
396
+            () => this.resizeContainer(VIDEO_CONTAINER_TYPE), emitter);
394
         this.addContainer(VIDEO_CONTAINER_TYPE, this.videoContainer);
397
         this.addContainer(VIDEO_CONTAINER_TYPE, this.videoContainer);
395
 
398
 
396
         // use the same video container to handle and desktop tracks
399
         // use the same video container to handle and desktop tracks

+ 1
- 1
modules/UI/videolayout/VideoLayout.js View File

113
     },
113
     },
114
 
114
 
115
     initLargeVideo () {
115
     initLargeVideo () {
116
-        largeVideo = new LargeVideoManager();
116
+        largeVideo = new LargeVideoManager(eventEmitter);
117
         if(localFlipX) {
117
         if(localFlipX) {
118
             largeVideo.onLocalFlipXChange(localFlipX);
118
             largeVideo.onLocalFlipXChange(localFlipX);
119
         }
119
         }

+ 6
- 1
service/UI/UIEvents.js View File

105
      * event must contain the identifier of the container that has been toggled
105
      * event must contain the identifier of the container that has been toggled
106
      * and information about toggle on or off.
106
      * and information about toggle on or off.
107
      */
107
      */
108
-    SIDE_TOOLBAR_CONTAINER_TOGGLED: "UI.side_container_toggled"
108
+    SIDE_TOOLBAR_CONTAINER_TOGGLED: "UI.side_container_toggled",
109
+
110
+    /**
111
+     * Notifies that the avatar is displayed or not on the largeVideo.
112
+     */
113
+    LARGE_VIDEO_AVATAR_DISPLAYED: "UI.large_video_avatar_displayed"
109
 };
114
 };

Loading…
Cancel
Save