Answer the question
In order to leave comments, you need to log in
Set landscape orientation when switching to Fullscreen mode on Android JW Player?
Good afternoon!
How can I set landscape orientation when switching to Fullscreen mode on Android, as implemented here - https://zedfilm.ru/1048529 (open from Android). I tried to look at the source and found there, it seems to me, the answer to my question, but it was not possible to make it work in the JW Player.
In short, in theory it should work like this:
1. Track the transition to fullscreen:
if(!window.screenTop && !window.screenY){} else {
// isFullscreen
}
2. Request the transition to landscape mode and block it:
screen. orientation.lock("landscape");
3. On exit, monitor exit from Fullscreen:
if(!window.screenTop && !window.
}
4. Unlock the screen orientation:
screen.orientation.unlock();
But it doesn’t work, I tried to hang up eventHandler and track the click on fullscreen through onclick. I use JW Player as a player.
Perhaps the JW Player has some kind of built-in eventHandler when going to fullscreen and exiting it?
Event is found, but even in this form, switching to landscape mode does not occur.
jwplayer("player").on('fullscreen', function (e) {
console.info('Fullscreen event');
var isFullScreen = jwplayer("player").getFullscreen();
if(isFullScreen && window.screen.orientation){
console.info('Fullscreen ON');
window.screen.orientation.lock("landscape");
} else if(window.screen.orientation) {
console.info('Fullscreen OFF');
window.screen.orientation.unlock();
}
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question