Browse Source

ref(LargeVideoManager): getCurrentContainer

Remove duplication and direct access to kind of private 'state' field by
introducing 'getCurrentContainer' method.
master
paweldomas 8 years ago
parent
commit
badbedf0f5
2 changed files with 20 additions and 6 deletions
  1. 19
    5
      modules/UI/videolayout/LargeVideoManager.js
  2. 1
    1
      modules/UI/videolayout/VideoLayout.js

+ 19
- 5
modules/UI/videolayout/LargeVideoManager.js View File

@@ -116,7 +116,8 @@ export default class LargeVideoManager {
116 116
         if (!this.state) {
117 117
             return;
118 118
         }
119
-        let container = this.getContainer(this.state);
119
+        const container = this.getCurrentContainer();
120
+
120 121
         container.onHoverIn(e);
121 122
     }
122 123
 
@@ -124,7 +125,8 @@ export default class LargeVideoManager {
124 125
         if (!this.state) {
125 126
             return;
126 127
         }
127
-        let container = this.getContainer(this.state);
128
+        const container = this.getCurrentContainer();
129
+
128 130
         container.onHoverOut(e);
129 131
     }
130 132
 
@@ -148,7 +150,7 @@ export default class LargeVideoManager {
148 150
     }
149 151
 
150 152
     get id () {
151
-        let container = this.getContainer(this.state);
153
+        const container = this.getCurrentContainer();
152 154
         return container.id;
153 155
     }
154 156
 
@@ -161,7 +163,7 @@ export default class LargeVideoManager {
161 163
 
162 164
         // Include hide()/fadeOut only if we're switching between users
163 165
         const isUserSwitch = this.newStreamData.id != this.id;
164
-        const container = this.getContainer(this.state);
166
+        const container = this.getCurrentContainer();
165 167
         const preUpdate = isUserSwitch ? container.hide() : Promise.resolve();
166 168
 
167 169
         preUpdate.then(() => {
@@ -177,7 +179,7 @@ export default class LargeVideoManager {
177 179
 
178 180
             logger.info("hover in %s", id);
179 181
             this.state = videoType;
180
-            const container = this.getContainer(this.state);
182
+            const container = this.getCurrentContainer();
181 183
             container.setStream(id, stream, videoType);
182 184
 
183 185
             // change the avatar url on large
@@ -509,6 +511,18 @@ export default class LargeVideoManager {
509 511
         return container;
510 512
     }
511 513
 
514
+    /**
515
+     * Returns {@link LargeContainer} for the current {@link state}
516
+     *
517
+     * @return {LargeContainer}
518
+     *
519
+     * @throws an <tt>Error</tt> if there is no container for the current
520
+     * {@link state}.
521
+     */
522
+    getCurrentContainer() {
523
+        return this.getContainer(this.state);
524
+    }
525
+
512 526
     /**
513 527
      * Remove Large container of specified type.
514 528
      * @param {string} type container type.

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

@@ -981,7 +981,7 @@ var VideoLayout = {
981 981
      * video.
982 982
      */
983 983
     getCurrentlyOnLargeContainer () {
984
-        return largeVideo.getContainer(largeVideo.state);
984
+        return largeVideo.getCurrentContainer();
985 985
     },
986 986
 
987 987
     isCurrentlyOnLarge (id) {

Loading…
Cancel
Save