]> _ Git - fluidbook-html5.git/commitdiff
fix #1461 @0.5
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 8 Jun 2017 14:40:48 +0000 (16:40 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 8 Jun 2017 14:40:48 +0000 (16:40 +0200)
js/libs/fluidbook/fluidbook.video.js

index 73c42f733e43a0ba8701f4506a378165452d53f9..ea464093cfa3f833c576fe68ac1f3a6af99c8324 100644 (file)
@@ -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