0

Actually i am using MPMoviePlayerViewController in our app . And my code perfectly working in iOS 8.4 but when i upload my app into iPad (iOS 9 ) its not working ...

I am create ViewController to play two video one by one but when one video is completed or stop the controller going to my first page of app and behave unespected in iOS 9 .I am using custom MPMoviePlayerViewController to play video and put one button on first video to change other video but its not working...

NSURL *URL = [[NSBundle mainBundle] URLForResource:@"video" withExtension:@"mp4"]; self.indiaplayer = [[MPMoviePlayerController alloc] initWithContentURL:URL]; self.indiaplayer.view.frame = CGRectMake(0, 0,1024,718); [self.indiavideoThumbnail addSubview: self.indiaplayer.view]; self.indiaplayer.controlStyle = MPMovieControlStyleNone; self.indiaplayer.fullscreen = YES; self.indiaplayer.repeatMode = YES; [self.indiaplayer prepareToPlay]; self.indiaplayer.shouldAutoplay = NO;

self.indiaplaybackView = [[UIView alloc] initWithFrame:CGRectZero];
self.indiaplaybackView.backgroundColor = [UIColor colorWithRed:242.0/255 green:163.0/255 blue:10.0/255 alpha:1];
//self.playbackView.layer.cornerRadius = 2;
[indiaView addSubview:self.indiaplaybackView];


self.indiaslider.minimumValue = START;
self.indiaslider.maximumValue = END;

Thanks in advance

Nishant Gupta
  • 113
  • 15

1 Answers1

1

wait wait in iOS 9.x.x

IMPORTANT The MPMoviePlayerViewController class is formally deprecated in iOS 9. (The MPMoviePlayerController class is also formally deprecated.) To play video content in iOS 9 and later, instead use the AVPictureInPictureController or AVPlayerViewController class from the AVKit framework, or the WKWebView class from WebKit.

For more detail

https://developer.apple.com/library/ios/documentation/MediaPlayer/Reference/MPMoviePlayerViewController_class/

Gagan_iOS
  • 3,248
  • 2
  • 24
  • 41
  • you can search for AVPlayerViewController sample code & tutorial. By the way please look this:-- http://stackoverflow.com/questions/25932570/how-to-play-video-with-avplayerviewcontroller-avkit-in-swift – Gagan_iOS Oct 31 '15 at 09:29
  • I am using MPMoviePlayerViewController class in iOS 9 and its working. you might want to cross check url for spaces. self.strVideoUrl = [self.strVideoUrl stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; – Deepak Thakur Dec 18 '15 at 11:09