Re: iOS AVPlayerViewController and AVPlayer Documentation/Help
Re: iOS AVPlayerViewController and AVPlayer Documentation/Help
- Subject: Re: iOS AVPlayerViewController and AVPlayer Documentation/Help
- From: Peter Tomaselli <email@hidden>
- Date: Thu, 11 May 2017 09:16:02 -0400
Hi Dave, not at all an expert on this but I think if you want “windowed”
playback on iOS you need to abandon AVPlayerViewController and instead use
your “own” AVPlayer instance pointed at an arbitrary AVPlayerLayer (which
some custom view of yours would host).
Never done it myself but searching on that combo of tech (an AVPlayer and
an AVPlayerLayer) might get you started.
Cheers.
On Thu, May 11, 2017 at 8:33 AM, Dave <email@hidden> wrote:
> 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
_______________________________________________
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