var changeOrientation = this.orientation != '';
var o = this.fluidbook.support.getOrientation();
var newo;
+
+ // If there is a full screen video playing, we must abort any orientation change
+ // because it will destroy the player and interrupt the video playback.
+ if (this.fluidbook.video.isVideoFullscreen()) {
+ //fb('### Full screen video detected -- aborting Fluidbook orientation change...');
+ this.fluidbook.video.resizeControls();
+ return false;
+ }
+
+
if (o == 0 || o == 180) {
newo = 'portrait';
$('body').removeClass('landscape');
this.fluidbook.displayOnePage = (this.orientation == 'portrait');
if (changeOrientation) {
+ //console.warn('Orientation change! ' + this.orientation);
$(this.fluidbook).trigger('fluidbook.resize.beforeOrientationChange');
this.fluidbook.zoom.resetZoom();
this.fluidbook.pageTransition();
var $this = this;
this.players = {};
+ this.fullscreenActive = false; // When set to true, this blocks page updates that would interrupt the video
// 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);
+ //fb('triggered beforePageTransition -- ' + $this.fluidbook.resize.orientation + ' --- REMOVING VIDEOS...');
$this.removeAllVideos();
});
$this.resizeControls();
});
+ $(window).on('videoFullscreenEntered', function() {
+ //fb('>>> Video player entered full screen mode...');
+ $this.fullscreenActive = true;
+ });
+
+ $(window).on('videoFullscreenExited', function() {
+ //fb('<<< Video player exited full screen mode.');
+
+ // Try resizing after a short delay. Depending on the system and the speed of the
+ setTimeout(function() {
+ $this.fluidbook.resize.resize();
+ }, 250);
+
+ setTimeout(function() {
+ $this.fullscreenActive = false; // Stop blocking orientation change / page updates
+ $this.fluidbook.resize.resize();
+ }, 1000);
+ });
+
this.fluidbook = fluidbook;
// $('#' + player.id()).attr('style', ''); // Reset inline styles
// });
+ player.on('fullscreenchange', function() {
+ if (player.isFullscreen()) {
+ $(window).trigger('videoFullscreenEntered');
+ } else {
+ $(window).trigger('videoFullscreenExited');
+ }
+ });
+
},
openVideo: function (link) {
if (link === undefined) return false;
return players;
},
+ isVideoFullscreen: function () {
+
+ return this.fullscreenActive;
+
+ // var fullscreenPlayerFound = false;
+ //
+ // this.getActivePlayers().forEach(function(p) {
+ // fb('Video ID: ' + p.id(), 'Fullscreen: ' + p.isFullscreen());
+ //
+ // if (p.isFullscreen()) {
+ // fullscreenPlayerFound = true;
+ // return true;
+ // }
+ //
+ // });
+ //
+ // return fullscreenPlayerFound;
+ },
+
resizeControls: function () {
// Scale VJS controls size with Fluidbook scale
$('.video-js').each(function () {