• 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
Problem Playing Movie File on iOS
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Problem Playing Movie File on iOS


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

Hi,

I’m tying to get a movie to play in iOS.

I have this in a View Controller. When I run it, it seems to play the file as I hear Audio but I get this message in the log:

Warning: Attempt to present <AVPlayerViewController: 0x7f945a814400> on <ViewController: 0x7f9458f056e0> whose view is not in the window hierarchy!

I’ve search for help on this but I get hundreds of solutions using all kinds of different techniques but none of them work. The Apple Documentation is totally useless from what I can see and offers no working solutions to build upon that I can find.

Here is the code:

-(void) viewDidLoad
{
AVPlayerViewController*			myViewController;
AVPlayer*					myPlayer;
NSURL*						myMovieFileURL;

[super viewDidLoad];

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

myViewController = [[AVPlayerViewController alloc] init];
[self presentViewController:myViewController animated:YES completion:nil];

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

I’m guess that I need to add a view to the AVPlayerViewController or vice versa?

Thanks in advance for any help.

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>
  • Prev by Date: Re: [solved] View based outline view checkboxes not showing state when window is not front most
  • Next by Date: Re: Problem Playing Movie File on iOS
  • Previous by thread: Re: Basic Question about iOS View Controllers/Storyboards
  • Next by thread: Re: Problem Playing Movie File on iOS
  • Index(es):
    • Date
    • Thread