avkit

Create iOS media playback with AVKit for UIKit and SwiftUI.

Updated Mar 31, 2026
One-click install
npx skills add https://github.com/DFly7/iOS-FastAPI-Supabase-AI --skill avkit
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: avkit
Source: https://github.com/DFly7/iOS-FastAPI-Supabase-AI/tree/main/.agents/skills/avkit
Command: npx skills add https://github.com/DFly7/iOS-FastAPI-Supabase-AI --skill avkit

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Building reliable, system-standard media playback experiences on iOS can be error-prone and fragmented across UIKit and SwiftUI, causing issues with background audio, Picture-in-Picture, AirPlay routing, subtitles, transport controls, and integration with system Now Playing controls. This Skill consolidates best practices, common pitfalls, and implementation patterns so developers can ship robust video playback without platform regressions.

Core Features & Use Cases

  • System-standard playback: Use AVPlayerViewController and AVPlayer to present video with native transport controls, subtitles, and Now Playing integration.
  • Picture-in-Picture & AirPlay: Enable PiP for inline and full-screen players and add AVRoutePickerView or external playback configuration for AirPlay support.
  • SwiftUI and custom UIs: Use VideoPlayer for simple SwiftUI layouts or wrap AVPlayerViewController / AVPlayerLayer for PiP, delegate callbacks, and advanced control.
  • Error handling & production concerns: Configure AVAudioSession, handle player item status and timeControlStatus, enforce linear playback during interstitials, and observe isReadyForDisplay to avoid black frames.
  • Use case: Ship a news or streaming app that supports HLS with multilingual subtitles, ad interstitials that require linear playback, PiP restore behavior, and AirPlay casting.

Quick Start

Configure the app's Info.plist for audio background mode and set AVAudioSession to .playback, then present AVPlayerViewController with your AVPlayer to begin playback.

Frequently Asked Questions about avkit

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I enable Picture-in-Picture for video playback in SwiftUI?

You enable Picture-in-Picture for video playback in SwiftUI by wrapping AVPlayerViewController with AVPictureInPictureController, ensuring AVAudioSession is set to .playback and background audio entitlements are configured.

Why does my iOS video player show a black frame before playback starts?

Your iOS video player shows a black frame before playback starts because isReadyForDisplay is not properly observed. Observe this property on AVPlayerViewController to update the UI only when the video is actually ready for display.

What's the best way to add AirPlay routing to an AVKit video player?

The best way to add AirPlay routing to an AVKit video player is to embed AVRoutePickerView in your UI or configure AVPlayer external playback settings, allowing users to cast streaming or local video to compatible external devices.

Does AVKit support HLS streaming with multilingual subtitles and ad interstitials?

Yes, AVKit supports HLS streaming with multilingual subtitles and ad interstitials. You manage AVPlayer media selection options for subtitles and enforce linear playback during interstitials by monitoring player item status and transport controls.

Do I need background modes configured for AVPlayer audio sessions?

Yes, you need background modes configured for AVPlayer audio sessions. You must enable the audio background mode in Info.plist and set AVAudioSession to .playback to ensure streaming media continues playing properly in the background.