]> _ Git - fluidbook-html5.git/commitdiff
Fix #1589 @2.25
authorStephen Cameron <stephen@cubedesigners.com>
Thu, 20 Jul 2017 16:43:41 +0000 (18:43 +0200)
committerStephen Cameron <stephen@cubedesigners.com>
Thu, 20 Jul 2017 16:43:41 +0000 (18:43 +0200)
js/libs/fluidbook/fluidbook.video.js

index c6cc5b3267aa1fd7a23689cf617bb3935decf2eb..a35069581fc8de8a966d76dfd54cf3a9c6dc7a4a 100644 (file)
@@ -358,9 +358,24 @@ FluidbookVideo.prototype = {
             this.pause();
         });
     },
-    removeAllVideos: function () {
-        var $this = this;
-        this.getActivePlayers().forEach(function (player) {
+    removeAllVideos: function (skipPopupVideos) {
+
+        // Videos contained inside a popup #view element are in a separate section of the DOM
+        // so they normally don't need to be removed. They are handled by the killVideosIn() function
+        skipPopupVideos = skipPopupVideos || true;
+
+        var $this = this,
+            playersToBeRemoved = this.getActivePlayers();
+
+        if (skipPopupVideos) {
+            // Filter out any videos that exist inside the #view element
+            playersToBeRemoved = playersToBeRemoved.filter(function (player) {
+                return ! $.contains(document.getElementById('view'), document.getElementById(player.id()));
+            });
+        }
+
+        // Remove video players
+        playersToBeRemoved.forEach(function (player) {
             $this.disposeVideo(player);
         });
     },