Просмотр исходного кода

feat(VideoContainer): add 'wasVideoRendered' flag

The 'wasVideoRendered' flag will tell whether or not we have any video
image rendered(even if stalled) on the large video element.
efficient_tiling
paweldomas 9 лет назад
Родитель
Сommit
42fd3097de
1 измененных файлов: 24 добавлений и 1 удалений
  1. 24
    1
      modules/UI/videolayout/VideoContainer.js

+ 24
- 1
modules/UI/videolayout/VideoContainer.js Просмотреть файл

@@ -174,14 +174,29 @@ export class VideoContainer extends LargeContainer {
174 174
         this.isVisible = false;
175 175
 
176 176
         this.$avatar = $('#dominantSpeaker');
177
+
178
+        /**
179
+         * Indicates whether or not the video stream attached to the video
180
+         * element has started(which means that there is any image rendered
181
+         * even if the video is stalled).
182
+         * @type {boolean}
183
+         */
184
+        this.wasVideoRendered = false;
185
+
177 186
         this.$wrapper = $('#largeVideoWrapper');
178 187
 
179 188
         this.avatarHeight = $("#dominantSpeakerAvatar").height();
180 189
 
190
+        var onPlayCallback = function (event) {
191
+            if (typeof onPlay === 'function') {
192
+                onPlay(event);
193
+            }
194
+            this.wasVideoRendered = true;
195
+        }.bind(this);
181 196
         // This does not work with Temasys plugin - has to be a property to be
182 197
         // copied between new <object> elements
183 198
         //this.$video.on('play', onPlay);
184
-        this.$video[0].onplay = onPlay;
199
+        this.$video[0].onplay = onPlayCallback;
185 200
     }
186 201
 
187 202
     /**
@@ -284,6 +299,14 @@ export class VideoContainer extends LargeContainer {
284 299
      * @param {string} videoType video type
285 300
      */
286 301
     setStream (stream, videoType) {
302
+
303
+        if (this.stream === stream) {
304
+            return;
305
+        } else {
306
+            // The stream has changed, so the image will be lost on detach
307
+            this.wasVideoRendered = false;
308
+        }
309
+
287 310
         // detach old stream
288 311
         if (this.stream) {
289 312
             this.stream.detach(this.$video[0]);

Загрузка…
Отмена
Сохранить