Screen orientation lock (screen.orientation.lock()) is not working in android webview.
function lockLandScape() {
console.log(JSON.stringify(screen.orientation.lock))
if (screen.orientation && screen.orientation.lock) {
screen.orientation.lock('landscape');
}
}
function unlockLandScape() {
if (screen.orientation && screen.orientation.unlock) {
screen.orientation.unlock()
}
}
function videoFullScreen(elem){
if (elem.requestFullscreen) {
elem.requestFullscreen();
} else if (elem.mozRequestFullScreen) {
elem.mozRequestFullScreen();
} else if (elem.webkitRequestFullscreen) {
elem.webkitRequestFullscreen();
} else if (elem.msRequestFullscreen) {
elem.msRequestFullscreen();
}
elem.classList.add("fullscreen");
lockLandScape()
}
Where elem is video element in webview.