Browse Source

Handle on player error so we can remove the player.

j8
damencho 9 years ago
parent
commit
ebe37ff98a
1 changed files with 17 additions and 4 deletions
  1. 17
    4
      modules/UI/shared_video/SharedVideo.js

+ 17
- 4
modules/UI/shared_video/SharedVideo.js View File

@@ -162,6 +162,8 @@ export default class SharedVideoManager {
162 162
 
163 163
         window.onPlayerError = function(event) {
164 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,8 +295,12 @@ export default class SharedVideoManager {
293 295
             return;
294 296
 
295 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 306
         if(this.intervalId) {
@@ -309,12 +315,19 @@ export default class SharedVideoManager {
309 315
                 VideoLayout.removeLargeVideoContainer(
310 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 328
         this.url = null;
317 329
         this.isSharedVideoShown = false;
330
+        this.initialAttributes = null;
318 331
     }
319 332
 }
320 333
 

Loading…
Cancel
Save