What I have to change from MPMovieViewController to AVPlayerViewController with iAd preroll objective-c

Hello I have tried everything to change the following code to AVPlayerView because MPMovieplayerViewController is not supported anymore in iOS 9 beta 2 and Xcode tell me to change it . I tried really everthing and I don't get it to work and apple only supports swift examples for that but I need it in Objective-C .


The only thing wich is a bit complicated on it is the iad Preroll But I simple don't get it to work with the AVPlayer View.


Here is the MPMovieViewController example wich works but not on iOS 9 beta 2 !




NSURL*url=[NSURL fileURLWithPath:[[NSBundle mainBundle]pathForResource:@"........." ofType:@"mp4"]];


MPMoviePlayerViewController*playercontroller=[[MPMoviePlayerViewController alloc]initWithContentURL:url];


[self presentMoviePlayerViewControllerAnimated:playercontroller];


[playercontroller.moviePlayer playPrerollAdWithCompletionHandler:^(NSError *error)

{

[playercontroller.moviePlayer play];

}];


playercontroller.moviePlayer.movieSourceType=MPMovieSourceTypeFile;


playercontroller=nil;



So please can anyone help me out .

What I have to change from that code that it will work with the AVPlayerView on iOS9 Beta 2


Thanks

With best regards Philipp

Replies

Same Issue HERE!!!!!