NathanaelA / nativescript-exoplayer

Please use: https://github.com/nstudio/nativescript-plugins/
27 stars 36 forks source link

How to fullscreen play? #20

Open hnyaoqingping opened 6 years ago

hnyaoqingping commented 6 years ago

Thanks! This is a wonderful plugin! How to play in fullscreen?

benoit-ponsero commented 6 years ago

+1

umair-ameen commented 6 years ago

+1

LSmint commented 5 years ago

+1

delanick commented 5 years ago

+1

codasana commented 5 years ago

+1

Omi231 commented 5 years ago

+1

adonus19 commented 5 years ago

+1

canmehmetjs commented 5 years ago

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 😄