Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6028057
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T04:40:57+00:00 2026-05-23T04:40:57+00:00

I am creating a application in which I can need to play a video

  • 0

I am creating a application in which I can need to play a video which I do by mpmovieplayer controller .Now i nee to do this for both orientation .But the frame doesnt get set properly .

The code is as follws

// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
    [super viewDidLoad];
    [self shouldAutorotateToInterfaceOrientation:[UIDevice currentDevice].orientation];

    NSURL *temp = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"Floating" ofType:@"mp4"]];
    mpviewController = [[MPMoviePlayerViewController alloc] initWithContentURL:temp]; 
    mpviewController.view.frame = CGRectMake(0, 0, 768, 1024);
    mpviewController.view.backgroundColor = [UIColor clearColor]; 
    mpviewController.moviePlayer.movieSourceType = MPMovieSourceTypeFile; 
    mpviewController.view.userInteractionEnabled= NO;
    mpviewController.moviePlayer.fullscreen= YES;
    mpviewController.moviePlayer.controlStyle = MPMovieControlStyleNone;
    [[mpviewController moviePlayer] play];

    [self.view addSubview:mpviewController.view]; 

}
// Override to allow orientations other than the default portrait orientation.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    currentOrientation = interfaceOrientation;
    //[self SetInterface];

    if(interfaceOrientation == UIInterfaceOrientationPortrait || interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown)
        mpviewController.view.frame = CGRectMake(0, 0, 768, 1024);
    else if(interfaceOrientation == UIInterfaceOrientationLandscapeLeft || interfaceOrientation == UIInterfaceOrientationLandscapeRight)
        mpviewController.view.frame = CGRectMake(0, 0, 1024, 768);




    return YES;
}

I dont know where I am wrong.Please let me know for any chages to make in code. So as to get proper orientation.

Ragards Abhi

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T04:40:58+00:00Added an answer on May 23, 2026 at 4:40 am

    First
    I believe you don’t need to resize the mpviewController as it will resize it self alone.
    you should only set the –

    Second

    In the shouldAutorotateToInterfaceOrientation you only set the supported directions in shouldAutorotateToInterfaceOrientation.

    - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {  
            return YES;
    }
    

    If it dose not do it you change the view properties in –

    -(void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration{
    
        if (UIInterfaceOrientationIsPortrait(interfaceOrientation)){
         //do what you want for portrait
         }else{
         //do what you want for landscape
        }
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am creating application which is having functionality like 1 person can view video
I am creating paint like application using WPF. Now i need to create control
I am creating an Installer for my application(which basically acts as an server). Now,
I am creating an application that will store passwords, which the user can retrieve
Hello I'm creating application for android no mater what kind but I need to
I'm creating a small application from which users can send mails, appointments and to-do
I am creating application in Winform which among other things will also need to
I'm creating a GUI application which interacts with database so I need fixture management
I'm creating an application which lets you define events with a time frame. I
I am creating an application which displays some messages and its directions in the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.