]> _ Git - fluidbook-html5.git/commitdiff
(no commit message)
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 4 Nov 2014 17:33:37 +0000 (17:33 +0000)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 4 Nov 2014 17:33:37 +0000 (17:33 +0000)
js/libs/fluidbook/fluidbook.js
js/libs/fluidbook/fluidbook.video.js

index 7749a3a93964e2cd8cd7b912031ff796c3b35b52..0ab6ce1654d20a98787960908f4e71240e80678c 100644 (file)
@@ -1079,6 +1079,11 @@ Fluidbook.prototype = {
                if (animate == undefined) {
                        animate = true;
                }
+
+               $('video').each(function () {
+                       this.pause();
+               });
+
                if ($('.mview').scrollTop() > 0) {
                        $('.mview').scrollTo(0, 500, function () {
                                $this.closeView(callback, all, animate);
@@ -1092,11 +1097,16 @@ Fluidbook.prototype = {
                        return;
                }
 
+               this.video.pauseAllVideos();
+
                var mview = $("#view .mview:last");
                if (all) {
-                       $("#view .mview:not(:last)").remove();
+                       var s = $("#view .mview:not(:last)");
+                       this.video.killVideosIn(s);
+                       $(s).remove();
                }
 
+
                var to = {
                        translateY: $(window).height() + 'px'
                };
@@ -1107,11 +1117,13 @@ Fluidbook.prototype = {
                if (animate && this.support.transitions2d) {
                        setTimeout(function () {
                                $(mview).one($this.support.getTransitionEndEvent(), function () {
+                                       this.video.killVideosIn(this);
                                        $(this).remove();
                                        callback();
                                }).addClass('animate').transform(to);
                        }, 50);
                } else {
+                       this.video.killVideosIn(mview);
                        $(mview).remove()
                        callback();
                }
index 83ac5a755117d39bf450b252a05cea9fb776df20..007458468217aa08997c50c54571c63cbb8524ed 100644 (file)
@@ -53,7 +53,7 @@ function FluidbookVideo(fluidbook) {
 }
 
 FluidbookVideo.prototype = {
-       initVideo: function(e) {
+       initVideo: function (e) {
                if ($(e).html() != '') {
                        return;
                }
@@ -85,7 +85,7 @@ FluidbookVideo.prototype = {
                        fv.loop = loop;
                        fv.soundOn = sound;
                        var flashvars = [];
-                       $.each(fv, function(k, v) {
+                       $.each(fv, function (k, v) {
                                flashvars.push(k + '=' + encodeURIComponent(v));
                        });
 
@@ -141,10 +141,10 @@ FluidbookVideo.prototype = {
 
                $(e).html(html);
        },
-       initCache: function() {
+       initCache: function () {
                var $this = this;
                $('body').append('<iframe id="videoframe" marginheight="0" marginwidth="0" scrolling="no" width="1" height="1" src="data/links/video.' + this.preferedFormat + '.html" frameborder="0"></iframe>');
-               $("#videoframe").load(function() {
+               $("#videoframe").load(function () {
                        var w = this.contentWindow;
                        var cache = w.applicationCache;
                        cache.addEventListener('downloading', $this.logCacheEvent, false);
@@ -157,7 +157,18 @@ FluidbookVideo.prototype = {
                        $(this).hide();
                });
        },
-       logCacheEvent: function(e) {
-               
-       }
+       logCacheEvent: function (e) {
+
+       },
+       pauseAllVideos: function () {
+               $('video').each(function () {
+                       this.pause();
+               });
+       },
+       killVideosIn: function (e) {
+               $(e).find('video').each(function () {
+                       this.pause();
+                       this.src = "";
+               });
+       },
 };
\ No newline at end of file