Open hnyaoqingping opened 6 years ago
+1
+1
+1
+1
+1
+1
+1
Currently I'm doing this to show video fullscreen in Nativescript Vue , i know it's not that good approach but at least it works.
var orientation = require("nativescript-orientation")
import { android as androidApp } from "tns-core-modules/application"
import { isAndroid } from "tns-core-modules/platform"
playVideo(){
this.$refs.videoHolder.nativeView.play()
if(isAndroid){
this.$refs.videoHolder.nativeView.entersFullScreenWhenPlaybackBegins = true;
this.$refs.videoHolder.nativeView.play()
const View = android.view.View;
const window = androidApp.startActivity.getWindow();
const decorView = window.getDecorView();
decorView.setSystemUiVisibility(
View.SYSTEM_UI_FLAG_HIDE_NAVIGATION |
View.SYSTEM_UI_FLAG_FULLSCREEN |
View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
);
orientation.setOrientation('landscape',true)
}
}
Then when user clicks on back button in fullscreen I'm checking for Back clicked event :
var applicationModule = require('tns-core-modules/application')
if (applicationModule.android) {
applicationModule.android.on(applicationModule.AndroidApplication.activityBackPressedEvent, backEvent);
}
function backEvent(args) {
orientation.setOrientation('portrait',true)
}
If anyone has better idea I'd gladly accept it 😄
Thanks! This is a wonderful plugin! How to play in fullscreen?