0

Am using AVPlayer to play video. Video playing without any problem except iPad Pro. In iPad pro its getting stuck or delayed to start.

avPlayerViewController = [[AVPlayerViewController alloc]init];
avPlayerItem = [[AVPlayerItem alloc]initWithURL:fileURL];
player = [[AVPlayer alloc]initWithPlayerItem:avPlayerItem];
avPlayerViewController.player = player;
[avPlayerViewController.view setFrame:CGRectMake(0, 0, biManager.screenSize.width, biManager.screenSize.height)];
[self.view addSubview:avPlayerViewController.view];
avPlayerViewController.showsPlaybackControls = false ;
[player play];
Karthikeyan Bose
  • 1,244
  • 3
  • 17
  • 26

1 Answers1

1

I think the initWithURL is a sync call and may stop your UI. I went around it in my code by saving the video to a temp file and start the play only when the file was downloaded. Alternatively, you can try loadValuesAsynchronouslyForKeys:completionHandler: as suggested in this SO post. Also, there should be a way to stream videos with buffering. May be with third party's API like AFNetworking?

Community
  • 1
  • 1
Alex
  • 995
  • 12
  • 25