Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Video played with AVPlayer has grey line to top and sides on iPhone 6S Plus

Tags:

ios

avplayer

This seems to be a device specific bug on only iPhone 6S Plus.

Steps:

  1. Download AVPlayer demo sample code
  2. Adjust AVPlayerDemoPlaybackView.xib so that MPlayback View has margins around it
  3. Make content view color white

1px grey lines will appear at the top and sides.

Anyone knows how to workaround this?

I have tried to put an opaque view that obscure the top, yet the line will still appear ABOVE the opaque view!

like image 381
samwize Avatar asked May 17 '16 03:05

samwize


2 Answers

Setting the AVPlayerLayer's shouldRasterize property to true makes the borders disappear.

like image 114
Tom Gilder Avatar answered Oct 05 '22 04:10

Tom Gilder


My suggestion would be that since your use case is an animated loop to ditch the AVPlayer and use a UIImageView.

UIImage has animatedImage(with:duration:) where you can input an array of images and animate them how you like.

I think this would solve your problem. In my experience AVPlayer has been a little wonky with iOS 10. I think that since you are only seeing this problem on the 6s+ and 7s+ is proof that it has some issues.

If you are absolutely committed to figuring out the AVPlayer, first submit a bug report to Apple. Then maybe try adding a UIImageView behind your AVPlayer that has the image set to a blank frame from your video. This is kind of a hacky solution, but it might work. Additionally, check out this stack overflow post. It might shed some light on the issues you are having with the AVPlayer.

Best of luck.

like image 36
Nate4436271 Avatar answered Oct 05 '22 05:10

Nate4436271