Hey all, today we are going to see a simple and straightforward implementation of AirPlay when using custom player controls as it is totally free with the AVPlayerViewController

To implement AirPlay routing we use AVRoutePickerView class. AVRoutePickerView is a subclass of UIView that displays control for picking playback routes.

  1. Enable AirPlay in the Background Mode under targets -> Signing & Capabilities

2. In order to make AVRoutePickerView detect external routes, we have to enable the allowsExternalPlayback property of the AVPlayer to true

3. Add the AVRoutePickerView instance to the view. AVRoutePickerView provides the system AirPlay icon.

routePickerViewWillBeginPresentingRoutes, routePickerViewDidEndPresentingRoutes are the delegates provided by the AVRoutePickerView

--

--

Pratheesh Bennet

Pratheesh Bennet

Product owner Falcon Forms (www.falconforms.app). Digitize your paperwork using Falcon Forms. Build and configure your own forms in an instant.