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

  • Home
  • SEARCH
  • 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 9002623
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T00:35:43+00:00 2026-06-16T00:35:43+00:00

okay guys Same question as everyone else. I got it to work if i

  • 0

okay guys
Same question as everyone else.
I got it to work if i edited the .plist to support all orientation, but i only need to support rotation at my MPMoviePlayerController (and maybe at my MWPhotoBrwoser images)

My code:
Viewcontroller.h

#import <UIKit/UIKit.h>
#import <AVFoundation/AVFoundation.h>
#import <MediaPlayer/MediaPlayer.h>

@interface MusikViewController : UIViewController{
    AVAudioPlayer *audioPlayer;

}

//tilføjer vores film afspiller
@property (nonatomic, strong) MPMoviePlayerController *moviePlayer;


//Laver de to knapper
//Musik knap
- (IBAction)Play:(UIButton *)sender;
//Film knap
- (IBAction)playButton:(id)sender;

//info knap
- (IBAction)info:(id)sender;


@end

Viewcontroller.m

#import "MusikViewController.h"



@implementation MusikViewController
@synthesize moviePlayer;


- (IBAction)Play:(UIButton *)sender
{
    NSURL *url = [NSURL fileURLWithPath:[NSString stringWithFormat:@"%@/roteWeste.mp4", [[NSBundle mainBundle] resourcePath]]];

    NSError *error;
    audioPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:url error:&error];
    audioPlayer.numberOfLoops = -1;

    if (audioPlayer == nil){
        NSLog(@"Der skete en fejl, prøv at genstarte app'en, hvis problemet bliver ved, prøv da at send en mail til Mrostgaard@gmail.com");
    }
    else
        [audioPlayer play];
}

- (IBAction)playButton:(id)sender {

    NSString *videoFile = [[NSBundle mainBundle] pathForResource:@"RoteVeste2" ofType:@"m4v"];

    moviePlayer = [[MPMoviePlayerController alloc]initWithContentURL:[NSURL fileURLWithPath:videoFile]];

    [self.view addSubview:moviePlayer.view];

    moviePlayer.fullscreen = YES;

    moviePlayer.allowsAirPlay = YES;
    moviePlayer.controlStyle = MPMovieControlModeVolumeOnly;


    [moviePlayer play];


}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
    {
        if ((UIDeviceOrientationIsLandscape(interfaceOrientation))||(UIDeviceOrientationIsLandscape(interfaceOrientation))) {
            return YES;
        }
        else return NO;
    }
    else
    {
        if ((UIDeviceOrientationIsLandscape(interfaceOrientation))||(UIDeviceOrientationIsLandscape(interfaceOrientation))) {
            return YES;
        }
        else return NO; }
}
- (void)viewWillDisappear:(BOOL)animated
{
    [super viewWillDisappear:animated];
    [audioPlayer stop]; // Or pause
}


- (IBAction)info:(id)sender {
}
@end

i just can’t seem to make it work. The code:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
    {
        if ((UIDeviceOrientationIsLandscape(interfaceOrientation))||(UIDeviceOrientationIsLandscape(interfaceOrientation))) {
            return YES;
        }
        else return NO;
    }
    else
    {
        if ((UIDeviceOrientationIsLandscape(interfaceOrientation))||(UIDeviceOrientationIsLandscape(interfaceOrientation))) {
            return YES;
        }
        else return NO; }
}

Is just my latest try but i have tried almost everything
Only need to rotate the MPMovieViewController.

I have even tried this, could not get it to work
http://fostah.com/ios/2012/09/27/ios6-orientation-handling.html

Really hoping for some help! 🙂

  • 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-06-16T00:35:45+00:00Added an answer on June 16, 2026 at 12:35 am

    When reading your question: ” I got it to work if i edited the .plist to support all orientation, but i only need to support rotation at my MPMoviePlayerController (and maybe at my MWPhotoBrwoser images)”, the first remark would be that you should allow all orientations in the .plist. The allowed orientations in your plist should be the union of all orientations the different view controllers in your application must support.

    Whatever you do in a specific view controller, you will never be able to allow rotation to an orientation that is not allowed in your plist.

    It is then up to all individual view controllers to say what orientations that particular view controller allows. So in steps:

    1. Allow all orientations in the plist that are supported by at
      least one view controller
    2. For all individual view controllers,
      use the shouldAutorotateToInterfaceOrientation (iOS5) and
      shouldAutorotate / supportedInterfaceOrientations (iOS6)
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Okay guys, I have read through all the other posts and question on jQuery
Okay, some Guys will know what i mean and edit my Question but they
Okay, here goes. Stack Overflow virgin here but hopefully you guys will be able
Okay, I have a question guys. I want to remote upload (copy an image
Okay, since none of you guys like my question, let me rephrase it. User
Okay guys, I'm sure this has a very simple solution but my searches are
Okay guys I have a question about positioning tables within DIV's using CSS. I
Okay guys, I've got one thats got me baffled. I've done some searching for
Possible Duplicate: How Turn on only Camera flash light programmatically in android? okay guys,
Hye guys. Okay. I have done this coding. But it seems have error. Can

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.