Forte Zhu
Forte Zhu

Reputation: 762

AVPlayerLayer Vs AVPlayerViewController

I am new to iOS app developing field. I am trying to capture video using AVFoundation. I am successful in this. But when I tried to play the video back using MPMoviePlayerController, I got too many issues. So I am trying to play using AVPlayer. But in AVPlayer there are two approaches AVPlayerLayer and AVPlayerViewController. I tried searching about those, but I didn't get any particular reason to choose one. Can anyone suggest me which is better to use?

Upvotes: 3

Views: 4206

Answers (1)

keithbhunter
keithbhunter

Reputation: 12324

AVPlayerViewController is an all in one solution. You setup your AVPlayer with a video and present the player controller. It handles all the playing and has its own controls baked in (I'm sure you've used seen this in other apps). It is the simplest way to show a video.

AVPlayerLayer is for when you want to add some customization, like adding your own controls or extra views, or not making the video full screen.

Upvotes: 6

Related Questions