gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-03 05:45:59 27 4
gpt4 key购买 nike

纵向模式视频可以使用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 tryadding this line within the Activity in question in your Manifest fileto 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/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com