浏览代码

Handle on player error so we can remove the player.

j8
damencho 9 年前
父节点
当前提交
ebe37ff98a
共有 1 个文件被更改,包括 17 次插入4 次删除
  1. 17
    4
      modules/UI/shared_video/SharedVideo.js

+ 17
- 4
modules/UI/shared_video/SharedVideo.js 查看文件

162
 
162
 
163
         window.onPlayerError = function(event) {
163
         window.onPlayerError = function(event) {
164
             console.error("Error in the player:", event.data);
164
             console.error("Error in the player:", event.data);
165
+            // store the error player, so we can remove it
166
+            self.errorInPlayer = event.target;
165
         };
167
         };
166
     }
168
     }
167
 
169
 
293
             return;
295
             return;
294
 
296
 
295
         if(!this.player){
297
         if(!this.player){
296
-            this.initialAttributes = attributes;
297
-            return;
298
+            // if there is no error in the player till now,
299
+            // store the initial attributes
300
+            if (!this.errorInPlayer) {
301
+                this.initialAttributes = attributes;
302
+                return;
303
+            }
298
         }
304
         }
299
 
305
 
300
         if(this.intervalId) {
306
         if(this.intervalId) {
309
                 VideoLayout.removeLargeVideoContainer(
315
                 VideoLayout.removeLargeVideoContainer(
310
                     SHARED_VIDEO_CONTAINER_TYPE);
316
                     SHARED_VIDEO_CONTAINER_TYPE);
311
 
317
 
312
-                this.player.destroy();
313
-                this.player = null;
318
+                if(this.player) {
319
+                    this.player.destroy();
320
+                    this.player = null;
321
+                }//
322
+                else if (this.errorInPlayer) {
323
+                    this.errorInPlayer.destroy();
324
+                    this.errorInPlayer = null;
325
+                }
314
         });
326
         });
315
 
327
 
316
         this.url = null;
328
         this.url = null;
317
         this.isSharedVideoShown = false;
329
         this.isSharedVideoShown = false;
330
+        this.initialAttributes = null;
318
     }
331
     }
319
 }
332
 }
320
 
333
 

正在加载...
取消
保存