Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion player/picture-in-picture/scrollListener.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,16 @@ function adjustPlayer() {
const lowerEdge = container.offset().top + container.height();
const switchToMinPlayerPos = lowerEdge - (window.innerHeight / 3);
const currentScrollPos = document.body.scrollTop || document.documentElement.scrollTop;
const nativePipEnabled = player.getViewMode() === bitmovin.player.ViewMode.PictureInPicture;

/* Disable CSS PiP, if native PiP is already in use */
if (nativePipEnabled) {
document.querySelector('.player-switch').classList.remove('fixed-player');
return;
}

/* toggle the css-class responsible for the player moving to the lower right corner */
if (currentScrollPos > switchToMinPlayerPos) {
if (currentScrollPos > switchToMinPlayerPos && !nativePipEnabled) {
$('.player-switch').addClass('fixed-player');
} else {
$('.player-switch').removeClass('fixed-player');
Expand Down
7 changes: 5 additions & 2 deletions player/picture-in-picture/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ var conf = {
)
;
}
}
},
viewmodechanged: function() {
adjustPlayer();
},
}
};

Expand All @@ -44,4 +47,4 @@ player.load(source).then(function () {
if (container.height() <= playerHeight) {
container.height(playerHeight);
}
});
});