android - YouTube API全屏人像模式视频android

标签 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/

最佳答案

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

On an orientation change, the onCreate method is called. You could try adding this line within the Activity in question in your Manifest file to prevent the onCreate call.

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

and it might maintain the fullscreen status of youtube for you.


您也可以尝试覆盖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:

Flag for setFullscreenControlFlags(int) to enable automatic control of the orientation.

The behavior is to force landscape orientation when entering fullscreen and switching back to the original orientation setting when leaving fullscreen. The implementation will also exit fullscreen automatically when the device is rotated back to portrait orientation. This should generally be set unless the application is locked in landscape orientation or you require fullscreen in portrait orientation.


希望这可以帮助!

关于android - YouTube API全屏人像模式视频android,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39438761/

相关文章:

java - 为什么我们必须在 onClick 方法中添加 'View' 作为参数以及它的作用是什么?

ios - 谷歌 API : YouTube video uplaod error = 403

php - 在YouTube API v3中捕获重复的上传错误

google-api - redirect_uri_mismatch 请求中的重定向 URI 与 OAuth 客户端授权的不匹配

android - 特定 Android Honeycomb 平板电脑(Orange Tahiti)上的奇怪焦点问题

java - 显示位置并将相机置于其中心位置时出现问题

java - 如何使用 android studio 创建两个 android 按钮

android - html5 mediaplayer 播放 youtube 视频

youtube - 是否有 YouTube API 可以为我提供有关视频的结构化元数据?

youtube-api - Youtube API 上传视频大小和长度限制