return;
},
pageTransition: function (pageNr) {
+
+ $(this).trigger('fluidbook.beforePageTransition');
+
this.tooltip.hideTooltip();
if (pageNr == undefined) {
pageNr = this.currentPage;
this.fluidbook.displayOnePage = (this.orientation == 'portrait');
if (changeOrientation) {
+ $(this.fluidbook).trigger('fluidbook.resize.beforeOrientationChange');
this.fluidbook.zoom.resetZoom();
this.fluidbook.pageTransition();
$(this.fluidbook).trigger('fluidbook.resize.orientation');
this.players = {};
- $(fluidbook).on('changePage', function (e, page) {
+ // Remove videos before page transition so we can properly handle page turns
+ // and orientation changes (switching from dual page to single page layout and vice-versa)
+ $(fluidbook).on('fluidbook.beforePageTransition', function () {
+ //fb('triggered beforePageTransition -- ' + $this.fluidbook.resize.orientation);
$this.removeAllVideos();
});
$this.resizeControls();
});
+
+
this.fluidbook = fluidbook;
this.video = (Modernizr.video && (Modernizr.video.h264 || Modernizr.video.webm || Modernizr.video.ogg)) != false;
return;
}
- // if ($('#videoPopup').length == 0) {
- // $('body').append('<div id="videoPopupOverlay"></div><div id="videoPopup"><a href="#" class="zoomPopupClose"><svg viewBox="0 0 20 20"><use xlink:href="#close"></use></svg></a></div>');
- //
- // $(document).on('click touchend', '.videoPopupLink', function(e) {
- // e.preventDefault();
- // $this.openVideo(this);
- // return false;
- // });
- // }
-
var id = $(e).data('id'),
width = parseFloat($(e).data('width')),
height = parseFloat($(e).data('height')),
// Player might be active but not visible so we need to dispose of it before re-initialising the element
if (videojs.players[id]) {
//fb(id + ' player already active. Disposing...');
- videojs(id).dispose();
+ try {
+ videojs(id).dispose();
+ }
+ catch (exception) {
+ console.warn('Error disposing player #' + id + ' -- ' + exception.message);
+ }
}