if (animate == undefined) {
animate = true;
}
+
+ $('video').each(function () {
+ this.pause();
+ });
+
if ($('.mview').scrollTop() > 0) {
$('.mview').scrollTo(0, 500, function () {
$this.closeView(callback, all, animate);
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'
};
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();
}
}
FluidbookVideo.prototype = {
- initVideo: function(e) {
+ initVideo: function (e) {
if ($(e).html() != '') {
return;
}
fv.loop = loop;
fv.soundOn = sound;
var flashvars = [];
- $.each(fv, function(k, v) {
+ $.each(fv, function (k, v) {
flashvars.push(k + '=' + encodeURIComponent(v));
});
$(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);
$(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