소스 검색

Merge pull request #922 from jitsi/fix_filter_not_applied

Fix notification about network issues not displayed when expected
master
Дамян Минков 8 년 전
부모
커밋
b3d6e5876e

+ 10
- 0
conference.js 파일 보기

@@ -681,6 +681,16 @@ export default {
681 681
         return this._room
682 682
             && this._room.getConnectionState();
683 683
     },
684
+    /**
685
+     * Checks whether or not our connection is currently in interrupted and
686
+     * reconnect attempts are in progress.
687
+     *
688
+     * @returns {boolean} true if the connection is in interrupted state or
689
+     * false otherwise.
690
+     */
691
+    isConnectionInterrupted () {
692
+        return connectionIsInterrupted;
693
+    },
684 694
     getMyUserId () {
685 695
         return this._room
686 696
             && this._room.myUserId();

+ 0
- 4
modules/UI/shared_video/SharedVideo.js 파일 보기

@@ -567,10 +567,6 @@ class SharedVideoContainer extends LargeContainer {
567 567
         this.player = player;
568 568
     }
569 569
 
570
-    get $video () {
571
-        return this.$iframe;
572
-    }
573
-
574 570
     show () {
575 571
         let self = this;
576 572
         return new Promise(resolve => {

+ 49
- 2
modules/UI/videolayout/LargeVideoManager.js 파일 보기

@@ -81,6 +81,27 @@ export default class LargeVideoManager {
81 81
         container.onHoverOut(e);
82 82
     }
83 83
 
84
+    /**
85
+     * Called when the media connection has been interrupted.
86
+     */
87
+    onVideoInterrupted () {
88
+        this.enableVideoProblemFilter(true);
89
+        let reconnectingKey = "connection.RECONNECTING";
90
+        $('#videoConnectionMessage')
91
+            .attr("data-i18n", reconnectingKey)
92
+            .text(APP.translation.translateString(reconnectingKey));
93
+        // Show the message only if the video is currently being displayed
94
+        this.showVideoConnectionMessage(this.state === VIDEO_CONTAINER_TYPE);
95
+    }
96
+
97
+    /**
98
+     * Called when the media connection has been restored.
99
+     */
100
+    onVideoRestored () {
101
+        this.enableVideoProblemFilter(false);
102
+        this.showVideoConnectionMessage(false);
103
+    }
104
+
84 105
     get id () {
85 106
         let container = this.getContainer(this.state);
86 107
         return container.id;
@@ -213,8 +234,7 @@ export default class LargeVideoManager {
213 234
      * @param enable <tt>true</tt> to enable, <tt>false</tt> to disable
214 235
      */
215 236
     enableVideoProblemFilter (enable) {
216
-        let container = this.getContainer(this.state);
217
-        container.$video.toggleClass("videoProblemFilter", enable);
237
+        this.videoContainer.enableVideoProblemFilter(enable);
218 238
     }
219 239
 
220 240
     /**
@@ -232,6 +252,24 @@ export default class LargeVideoManager {
232 252
         $('.watermark').css('visibility', show ? 'visible' : 'hidden');
233 253
     }
234 254
 
255
+    /**
256
+     * Shows/hides the "video connection message".
257
+     * @param {boolean|null} show(optional) tells whether the message is to be
258
+     * displayed or not. If missing the condition will be based on the value
259
+     * obtained from {@link APP.conference.isConnectionInterrupted}.
260
+     */
261
+    showVideoConnectionMessage (show) {
262
+        if (typeof show !== 'boolean') {
263
+            show = APP.conference.isConnectionInterrupted();
264
+        }
265
+
266
+        if (show) {
267
+            $('#videoConnectionMessage').css({display: "block"});
268
+        } else {
269
+            $('#videoConnectionMessage').css({display: "none"});
270
+        }
271
+    }
272
+
235 273
     /**
236 274
      * Add container of specified type.
237 275
      * @param {string} type container type
@@ -285,8 +323,12 @@ export default class LargeVideoManager {
285 323
         }
286 324
 
287 325
         let oldContainer = this.containers[this.state];
326
+        // FIXME when video is being replaced with other content we need to hide
327
+        // companion icons/messages. It would be best if the container would
328
+        // be taking care of it by itself, but that is a bigger refactoring
288 329
         if (this.state === VIDEO_CONTAINER_TYPE) {
289 330
             this.showWatermark(false);
331
+            this.showVideoConnectionMessage(false);
290 332
         }
291 333
         oldContainer.hide();
292 334
 
@@ -295,7 +337,12 @@ export default class LargeVideoManager {
295 337
 
296 338
         return container.show().then(() => {
297 339
             if (type === VIDEO_CONTAINER_TYPE) {
340
+                // FIXME when video appears on top of other content we need to
341
+                // show companion icons/messages. It would be best if
342
+                // the container would be taking care of it by itself, but that
343
+                // is a bigger refactoring
298 344
                 this.showWatermark(true);
345
+                this.showVideoConnectionMessage(/* fetch the current state */);
299 346
             }
300 347
         });
301 348
     }

+ 11
- 0
modules/UI/videolayout/VideoContainer.js 파일 보기

@@ -184,6 +184,17 @@ export class VideoContainer extends LargeContainer {
184 184
         this.$video[0].onplay = onPlay;
185 185
     }
186 186
 
187
+    /**
188
+     * Enables a filter on the video which indicates that there are some
189
+     * problems with the media connection.
190
+     *
191
+     * @param {boolean} enable <tt>true</tt> if the filter is to be enabled or
192
+     * <tt>false</tt> otherwise.
193
+     */
194
+    enableVideoProblemFilter (enable) {
195
+        this.$video.toggleClass("videoProblemFilter", enable);
196
+    }
197
+
187 198
     /**
188 199
      * Get size of video element.
189 200
      * @returns {{width, height}}

+ 5
- 15
modules/UI/videolayout/VideoLayout.js 파일 보기

@@ -951,28 +951,18 @@ var VideoLayout = {
951 951
      * Indicates that the video has been interrupted.
952 952
      */
953 953
     onVideoInterrupted () {
954
-        this.enableVideoProblemFilter(true);
955
-        let reconnectingKey = "connection.RECONNECTING";
956
-        $('#videoConnectionMessage')
957
-            .attr("data-i18n", reconnectingKey)
958
-            .text(APP.translation.translateString(reconnectingKey))
959
-            .css({display: "block"});
954
+        if (largeVideo) {
955
+            largeVideo.onVideoInterrupted();
956
+        }
960 957
     },
961 958
 
962 959
     /**
963 960
      * Indicates that the video has been restored.
964 961
      */
965 962
     onVideoRestored () {
966
-        this.enableVideoProblemFilter(false);
967
-        $('#videoConnectionMessage').css({display: "none"});
968
-    },
969
-
970
-    enableVideoProblemFilter (enable) {
971
-        if (!largeVideo) {
972
-            return;
963
+        if (largeVideo) {
964
+            largeVideo.onVideoRestored();
973 965
         }
974
-
975
-        largeVideo.enableVideoProblemFilter(enable);
976 966
     },
977 967
 
978 968
     isLargeVideoVisible () {

Loading…
취소
저장