tezvyn:

Play a remote video with AVFoundation

Source: interviewbeginner

WHAT IT TESTS: Knowing the AVPlayer rendering stack. OUTLINE: Wrap the URL in AVPlayerItem, feed it to AVPlayer, render with AVPlayerLayer added to the view's layer (or AVPlayerViewController for controls).

WHAT IT TESTS: Whether you know the separation between the player and its visual layer. ANSWER OUTLINE: Create an AVPlayerItem from the remote URL via AVURLAsset, give it to an AVPlayer that controls playback. To show it inside a UIView, create an AVPlayerLayer with that player, set its frame and videoGravity, and add it as a sublayer; or embed AVPlayerViewController for built-in controls. Call play() to start. RED FLAG: Expecting AVPlayer to render on its own, or trying to display frames in a UIImageView.

Read the original → interview

Get five bites like this every day.

Tezvyn delivers a daily feed of 60-second tech bites with quizzes to lock in what you learn.

Play a remote video with AVFoundation · Tezvyn