0

When i use below code on ios 10.2,

 MPMoviePlayerViewController *c = [[MPMoviePlayerViewController alloc] initWithContentURL:url];
      [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(movieLoadStateDidChange:) name:MPMoviePlayerLoadStateDidChangeNotification object:nil];
   [self.navigationController presentMoviePlayerViewControllerAnimated:c];
    [c.moviePlayer play];

But when I execute this code this have stoped automatically on

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

Please help. Is any changes in info.plist?

kb920
  • 3,039
  • 2
  • 33
  • 44
ayushi
  • 101
  • 1
  • 11
  • I also have used the belwo code – ayushi Apr 27 '17 at 06:21
  • AVAsset *asset = [AVAsset assetWithURL:url]; AVPlayerItem *item = [[AVPlayerItem alloc] initWithAsset:asset]; AVPlayer* player = [[AVPlayer alloc] initWithPlayerItem:item]; player.volume = 5.0; AVPlayerLayer *layer = [AVPlayerLayer playerLayerWithPlayer:player]; layer.frame = self.view.layer.bounds; – ayushi Apr 27 '17 at 06:21
  • UIView *view = [[UIView alloc] initWithFrame:self.view.frame]; //view.backgroundColor = [UIColor blackColor]; [view.layer addSublayer:layer]; [self.view addSubview:view]; [player play]; – ayushi Apr 27 '17 at 06:21
  • But this is not playing videos – ayushi Apr 27 '17 at 06:22

0 Answers0