I am having a Bitmovin player instance and I am trying to force fullscreen when device orientation changes to landscape. Code goes like this:
const portrait = window.matchMedia("(orientation: portrait)");
portrait.addEventListener("change", function (e) {
window.dispatchEvent(new Event('resize'));
if (!e.matches && player.isPlaying() && (player.getViewMode() == 'inline')) {
player.setViewMode('fullscreen');
}
if (e.matches && player.isPlaying() && (player.getViewMode() == 'fullscreen')) {
player.setViewMode('inline');
}
})
Event listener works correctly, but on Chrome in Android phones I get a TypeError: fullscreen error
If I force fullscreen via console in dev tools and restore to inline view, behaviour changes and video goes fullscreen on orientation change.
Researching I found that Chrome requires either user gestures for fullscreen events, or call them through an event (as is the case here) so I cannot figure out what is wrong.
Behaviour is the same using the native fullscreen api instead of bitmovin's setViewMode()
functions