Success path after canceling mpmovieplayercontroller in iOS9

I have some code that does:

    self.video = [[MPMoviePlayerController alloc] initWithContentURL:[NSURL URLWithString:url]];
    self.video.movieSourceType = MPMovieSourceTypeStreaming;
    [[self.video view] setFrame:[[self view] bounds]];
    [self.view addSubview:self.video.view];
    [self.video play];

      

It basically downloads the url and starts playing it. With the deprecated MPMoviePlayerController, what is the structure used to do the above functions.

+3


source to share


1 answer


Use below Apple methods. Basically, using the AVFoundation

framework, also supports picture-in-picture function to support the latest iOS 9 multitasking function.

Apple Documentation



The AVKit framework provides an AVPlayerViewController class that automatically renders the PiP button to your users.

If you support PiP using AVKit but want to opt out of PiP for a specific video, assign a NO value for the player view controllers to the allowPictureInPicturePlayback property.

AVKit also provides the AVPictureInPictureController class that you can use with the AVPlayerLayer class from the AV Foundation. Use this if you want to provide your own controller and UI for video playback.

+1


source







All Articles