Search code examples
iosswiftxcodeavkit

AVPlayer on top of UIView


I'm new to using AVKit and was wondering if it was possible to mask a player onto a UIView. So the frame of the video is the frame of the cell.

If so where / how would I implement this.

Additionally,

If you know of any AVKit quick start guides or tutorials that'd be helpful.


Solution

  • yes, basically all you have to do is call self.view.addSubview(AVPlayerLayer), and this is a layer for the APPlayer; after you instantiate the cell view, then make sure that AVPlayer.frame = view.bounds