iOS AVPlayerViewController and AVPlayer Documentation/Help
iOS AVPlayerViewController and AVPlayer Documentation/Help
- Subject: iOS AVPlayerViewController and AVPlayer Documentation/Help
- From: Dave <email@hidden>
- Date: Thu, 11 May 2017 14:33:36 +0200
Hi,
The following code plays a movie file in Full Screen, I’d like to be able to play a Video inside an arbitrary View with the option to go into full screen. I’ve searched for info on this seemingly simple task but can’t seem to find anything useful. I’ve tried setting myPlayerViewController.view.frame but this doesn’t seem to work. I found some iOS 6 code that I wrote ages ago which does this, but of course this has changed so much since then…..
Any help on this greatly appreciated.
All the Best
Dave
-(void) viewDidAppear:(BOOL) theAnimatedFlag
{
NSURL* myMovieFileURL;
AVPlayer* myPlayer;
AVPlayerViewController* myPlayerViewController;
CGRect myFrameRect;
myMovieFileURL = [[NSBundle mainBundle] URLForResource:@"Demo-ENG-EX-001" withExtension:@"mp4"];
myPlayer = [[AVPlayer alloc] initWithURL:myMovieFileURL];
myPlayerViewController = [[AVPlayerViewController alloc] init];
myPlayerViewController.player = myPlayer;
[self presentViewController:myPlayerViewController animated:YES completion:^
{
[myPlayer play];
}];
}
_______________________________________________
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