Hi Community,
I succeeded in implementing the above mentioned objective. Below are the solution steps:
1) Add the below JSON in extensibility configuration (Application Module Level)
JS Code Snippet:
{
"preferences": {
"global": [
{
"name": "orientation",
"value": "portrait"
}
]
},
"plugin" : {
"url": "https://github.com/apache/cordova-plugin-screen-orientation.git"
}
}
2) Define a JS node in Screen OnReady action flow - include the below JavaScript code:
JS Code Snippet:
(Event Handler for VideoWidget FullScreen)
// JS to unlock the existing screen orientation
var videoElement = document.getElementsByTagName('video')[0]; // get the video element
$(videoElement).bind('webkitfullscreenchange mozfullscreenchange fullscreenchange', function(e) {
var state = document.fullScreen || document.mozFullScreen || document.webkitIsFullScreen;
var event = state ? 'FullscreenOn' : 'FullscreenOff';
if (event === 'FullscreenOn') {
screen.orientation.unlock(); // unlock the existing orientation
} else {
$actions.OnDestroy();
}
});
3) Define a OnDestroy Event Handler - include a JS node with below script:
screen.orientation.lock('portrait');
Hope this will help someone in need.
Regards,
Benjith Sam