From d0781b504c3748f6f1ac2e39603ff9fe11beb9e1 Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Thu, 8 Jun 2017 16:40:48 +0200 Subject: [PATCH] fix #1461 @0.5 --- js/libs/fluidbook/fluidbook.video.js | 41 ++++++++++++++++------------ 1 file changed, 24 insertions(+), 17 deletions(-) diff --git a/js/libs/fluidbook/fluidbook.video.js b/js/libs/fluidbook/fluidbook.video.js index 73c42f73..ea464093 100644 --- a/js/libs/fluidbook/fluidbook.video.js +++ b/js/libs/fluidbook/fluidbook.video.js @@ -331,23 +331,28 @@ FluidbookVideo.prototype = { }); }, removeAllVideos: function () { + var $this = this; this.getActivePlayers().forEach(function (player) { + $this.disposeVideo(player); + }); + }, - var id = player.id(); - - // Save the current player info if it has started - if (player.hasStarted()) { - fluidbook.video.players[id] = { - currentTime: player.currentTime(), - volume: player.volume(), - muted: player.muted(), - paused: player.paused() - }; - } + disposeVideo: function (player) { + var id = player.id(); + + // Save the current player info if it has started + if (player.hasStarted()) { + fluidbook.video.players[id] = { + currentTime: player.currentTime(), + volume: player.volume(), + muted: player.muted(), + paused: player.paused() + }; + } - //fb('Disposing video ID ' + id); - player.dispose(); - }); + //fb('Disposing video ID ' + id); + player.dispose(); + return id; }, getActivePlayers: function () { @@ -382,9 +387,11 @@ FluidbookVideo.prototype = { }, killVideosIn: function (e) { - $(e).find('video').each(function () { - this.pause(); - this.src = ""; + var $this = this; + $(e).find('.videoContainer').each(function () { + var id = $(this).data('id'); + var player = videojs(id); + $this.disposeVideo(player); }); }, }; \ No newline at end of file -- 2.39.5