# avkit

Guides AI agents through building iOS media playback UI, configuring AVPlayerViewController, SwiftUI VideoPlayer, and Picture-in-Picture.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode · 3200 installs · ★ 1237
- Author: dpearson2699
- License: LicenseRef-Unknown · policy=link-only · description only; the file stays with the author
- Source: https://github.com/dpearson2699/swift-ios-skills/tree/HEAD/skills/avkit/SKILL.md
- Updated: 2026-07-31
- HTML: https://affpapa.org/en/nevibecode/skills/avkit

## What it does

This skill provides code patterns for AVKit and AVFoundation playback UI on iOS. It gives coding assistants guidance for presenting `AVPlayerViewController`, embedding it inside existing UIKit view hierarchies, or rendering SwiftUI `VideoPlayer` views. It explicitly tells the agent never to subclass `AVPlayerViewController`.

Setting up background audio and Picture-in-Picture requires specific steps. You must add the audio value to `UIBackgroundModes`, set the audio session category to `.playback`, and defer calling `setActive(true)` until playback starts. PiP fails when an item contains only audio or uses an unsupported container, so the skill highlights checks for playable media before activation.

To prevent a black flash before playback starts, the guide shows how to observe `isReadyForDisplay`. For advanced SwiftUI controls like custom delegate callbacks or speed adjustments, it details wrapping the UIKit player in `UIViewControllerRepresentable`.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add dpearson2699/swift-ios-skills --skill avkit -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/avkit/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/avkit/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add dpearson2699/swift-ios-skills --skill avkit -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/avkit/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add dpearson2699/swift-ios-skills --skill avkit -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/avkit/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install dpearson2699/swift-ios-skills avkit
```

2. **Manually: put the files in place**
- File: `.github/skills/avkit/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add dpearson2699/swift-ios-skills --skill avkit -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/dpearson2699/swift-ios-skills --path skills/avkit
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/avkit/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add dpearson2699/swift-ios-skills --skill avkit -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/dpearson2699/swift-ios-skills/tree/HEAD/skills/avkit/SKILL.md

## When to use it
- embed AVPlayerViewController inside a UIKit container view
- configure AVAudioSession and background modes for Picture-in-Picture
- overlay custom branding onto a SwiftUI VideoPlayer
- prevent black flashes before media playback begins

## Example prompts
- Show how to embed AVPlayerViewController as a child view controller
- Configure AVAudioSession for video playback and Picture-in-Picture
- Create a SwiftUI VideoPlayer with an interactive overlay

## Similar
- [axiom-media](https://affpapa.org/en/nevibecode/skills/axiom-media.md) — skill · 1300 installs
- [iphone-duo-camera](https://affpapa.org/en/nevibecode/skills/iphone-duo-camera.md) — skill · 500 installs
- [xcode-project-setup](https://affpapa.org/en/nevibecode/skills/xcode-project-setup.md) — skill · 130700 installs
- [expo-migrate-module](https://affpapa.org/en/nevibecode/skills/expo-migrate-module.md) — skill · 19400 installs
- [clerk-swift](https://affpapa.org/en/nevibecode/skills/clerk-swift.md) — skill · 14500 installs
- [swiftdata-pro](https://affpapa.org/en/nevibecode/skills/swiftdata-pro.md) — skill · 9300 installs

From the same set: [dpearson2699/swift-ios-skills](https://affpapa.org/en/nevibecode/by/dpearson2699/swift-ios-skills.md) — 86 cards

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
