• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Problem Playing Movie File on iOS
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problem Playing Movie File on iOS


  • Subject: Re: Problem Playing Movie File on iOS
  • From: Dave <email@hidden>
  • Date: Tue, 9 May 2017 17:03:31 +0200

> On 9 May 2017, at 15:41, Peter Tomaselli <email@hidden> wrote:
>
> I don't believe you can present a view controller in viewDidLoad. I am away from my computer, so I can't confirm right now, but I do not believe the presenting view controller's view is in the view hierarchy yet during viewDidLoad (exactly as the error message says).

I realised that a few minutes after posting. I moved it into viewWillAppear and it sort of works, moved it into viewDidAppear and it works BUT the code should be:

-(void) viewDidAppear:(BOOL) theAnimatedFlag
{
NSURL*						myMovieFileURL;
AVPlayer*					myPlayer;
AVPlayerViewController*		myPlayerViewController;

myMovieFileURL = [[NSBundle mainBundle] URLForResource:@"OrchidDemo-ENG-EX-001" withExtension:@"mp4"];
myPlayer = [[AVPlayer alloc] initWithURL:myMovieFileURL];

myPlayerViewController = [[AVPlayerViewController alloc] init];
[self.pMovieView addSubview:myPlayerViewController.view];			//***************************************

[self presentViewController:myPlayerViewController animated:YES completion:nil];

myPlayerViewController.player = myPlayer;
[myPlayer play];
}

All the Best
Dave


_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Problem Playing Movie File on iOS
      • From: Peter Tomaselli <email@hidden>
References: 
 >Problem Playing Movie File on iOS (From: Dave <email@hidden>)
 >Re: Problem Playing Movie File on iOS (From: Peter Tomaselli <email@hidden>)

  • Prev by Date: Re: Problem Playing Movie File on iOS
  • Next by Date: Re: Problem Playing Movie File on iOS
  • Previous by thread: Re: Problem Playing Movie File on iOS
  • Next by thread: Re: Problem Playing Movie File on iOS
  • Index(es):
    • Date
    • Thread