AVCaptureVideoPreviewLayer is a CALayer subclass that can be used to display a live feed from the camera. It can be used to control video stretching and focusing. It also includes some interesting utility methods for translating layer coordinates to device coordinates. This UIView subclass can be implemented to provide a video preview in all three dimensions. It is important to note that AVCaptureVideoPreviewLayer does not support panorama or square cameras. It also lacks the built-in focus peaking mechanism of AVFoundation, which can be implemented with the aid of an UISlider.

The most important function of AVCaptureVideoPreviewLayer, however, is the display of the camera’s output. This includes the video, the UIImageView, and the camera preview itself. The preview can be resized to fit the screen. This may require some tweaking. It is also possible to set the video orientation to match the user’s UI. The display also entails a rotation, which is achieved by applying a GLKView transform.

AVCaptureVideoPreviewLayer may be the most important layer of the AVPlayerViewController subclass, but it is not the only one. This subclass also contains a number of interesting features, including the MVCMotionMirror class, which lets you display a live image of the camera’s output. It is also possible to enable flash and display the camera’s UIImageView. If you want to play a video in this layer, you will need to set the AVCaptureVideoDataOutput to a suitable output format. You will also want to use the AVCaptureVideoRect class to configure the display. This class includes a number of useful functions, including a function for determining whether the device is on or off. It also has a feature that allows you to rotate a CGRect. This is the same function that can be used to rotate a UISlider, but in a more sophisticated manner.

While the AVPlayerViewController is a nifty piece of iOS code, the real trick to producing a great live video feed is to implement the correct CGRect. This is done by calling setCGRect and specifying the CGPoint. In addition to this, the MVCMotionMirror will tell you whether or not the camera is on. If it is off, you will want to call a function called startRunning to start a new session. The AVCaptureSession class is also important for managing the flow of data. It allows you to switch from the front to the back camera. If you are lucky, you might even get an interruption by an unsolicited phone call. However, this is a rare occurrence.

The AVPlayerViewController can also be used to record video. It can also play the video itself, but only if you tell it to. The AVPlayerViewController is also the most complex layer of the AVPlayerViewLayer subclass, which means that its subclasses are more complex. Its subclasses may require some tweaking before you get the effect you are after. If you are looking for a complete project, you can find one on GitHub. It may even be easier to use AVFoundation instead.