当我的整个应用程序处于纵向模式锁定时,以横向模式播放全屏视频 [英] Play video fullscreen in landscape mode, when my entire application is in lock in portrait mode

查看:148
本文介绍了当我的整个应用程序处于纵向模式锁定时,以横向模式播放全屏视频的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望以全屏模式在横向模式下播放视频。
我的应用程序锁定在纵向模式。
如何实现这一点。请帮帮我。
提前致谢

I want to play video in landscape mode in fullscreen. And my application is lock in portrait mode. How to implement this. Please help me. Thanks in advance

推荐答案

我已经完成了我的应用程序。要做到这一点,你需要检查你的视频控制器是否要播放视频。

I've done this in on of my app. To do this you need to check that is your viewcontroller that where you want to play a video.


  • 你要做的第一件事要做的是检查设备方向为纵向,横向左侧,横向位于项目目标中

  • The first thing you have to do is check Device Orientation to Portrait,Landscape left, Landscape right in your project target

在您的AppDelegate中执行以下代码

In your AppDelegate do the below code

-(NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window{

    UIStoryboard *mainStoryboard;
    if (IS_IPHONE) {
        mainStoryboard= [UIStoryboard storyboardWithName:@"Main" bundle: nil];
    }
    else{
       mainStoryboard= [UIStoryboard storyboardWithName:@"Main_iPad" bundle: nil];
    }

    ViewControllerThatPlaysVideo *currentViewController=    ViewControllerThatPlaysVideo*)[mainStoryboard     instantiateViewControllerWithIdentifier:@"postDetailView"];
    if(navigationController.visibleViewController isKindOfClass:    [ViewControllerThatPlaysVideo class]]){
       if([currentViewController playerState])
            return UIInterfaceOrientationMaskLandscape|UIInterfaceOrientationMaskPortrait;
       return UIInterfaceOrientationMaskPortrait;
    }
    return UIInterfaceOrientationMaskPortrait;
}


这篇关于当我的整个应用程序处于纵向模式锁定时,以横向模式播放全屏视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆