From 03e91ddaf71bd4f70ee057f0988be0976a960024 Mon Sep 17 00:00:00 2001 From: Stephen Cameron Date: Thu, 20 Jul 2017 18:43:41 +0200 Subject: [PATCH] Fix #1589 @2.25 --- js/libs/fluidbook/fluidbook.video.js | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/js/libs/fluidbook/fluidbook.video.js b/js/libs/fluidbook/fluidbook.video.js index c6cc5b32..a3506958 100644 --- a/js/libs/fluidbook/fluidbook.video.js +++ b/js/libs/fluidbook/fluidbook.video.js @@ -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); }); }, -- 2.39.5