aslanyanhaik / youtube-iOS

youtube iOS app template written in swift 5
MIT License
2.54k stars 573 forks source link

AVPlayerLayer frame doesn't fit into UIView for video player #7

Closed tobitech closed 7 years ago

tobitech commented 7 years ago

Hello!. I'm trying to replicate this in my app I got the minimising feature right but couldn't get AVPlayerPlayer to fit into the UIView for a video player in my code, I have set this playerLayer.frame = self.videoPlayerView.frame self.videoPlayerView.layer.addSublayer(playerLayer) but it still not inside of it. Where in the code could I be getting it wrong? It's just a thin rect at the middle of the screen as shown in the screenshot.

screen shot 2016-10-21 at 10 10 59 am
tobitech commented 7 years ago

Okay I found a way to fix it using Apple's documentation of AVPlayerLayer.