Youtube api全屏肖像模式视频android

时间:2016-09-11 17:27:33

标签: android youtube youtube-api android-youtube-api

人像模式视频可以通过YouTube应用程序以纵向全屏播放,这可以通过Android中的youtube播放器api实现吗?

这就是我指的: http://thenextweb.com/apps/2015/07/22/you-can-now-watch-vertical-videos-in-full-screen-on-youtubes-android-app/

1 个答案:

答案 0 :(得分:4)

即使手机处于纵向模式,您也可以在此SO answer中看到有关如何保持全屏模式的解决方案。

  

在方向更改时,将调用onCreate方法。你可以试试   在您的清单文件中的相关活动中添加此行   防止onCreate调用。

android:configChanges="orientation|keyboardHidden|screenSize|layoutDirection"
     

它可能会为你保持youtube的全屏状态。

您也可以尝试覆盖onConfigurationChanged方法:

@Override //reconfigure display properties on screen rotation
    public void onConfigurationChanged(Configuration newConfig) {
        super.onConfigurationChanged(newConfig);

            //Checks the orientation of the screen
            if (newConfig.orientation == Configuration.ORIENTATION_PORTRAIT) 
                {
                // handle change here
                } 
            else if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE)
                {
                // or here
                }
    }

您还可以阅读此documentation

  

setFullscreenControlFlags(int)的标记,可以自动控制方向。

     

行为是在进入全屏时强制横向方向,并在离开全屏时切换回原始方向设置。当设备旋转回纵向时,实现也将自动退出全屏。 除非应用程序以横向方向锁定,或者您需要纵向纵向显示 ,否则通常应设置此项。

希望这有帮助!

相关问题