apple-media

Capture, play, edit, and transcode audio, video, and photos with AVFoundation, PhotoKit, and VideoToolbox.

Updated Jun 17, 2026
One-click install
npx skills add https://github.com/Yar177/appleNativeSkills --skill apple-media-yar177
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: apple-media
Source: https://github.com/Yar177/appleNativeSkills/tree/main/apple-media
Command: npx skills add https://github.com/Yar177/appleNativeSkills --skill apple-media-yar177

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Building camera capture, media playback, video editing, or photo-library features on Apple platforms requires navigating AVFoundation, PhotoKit, and VideoToolbox, where permission handling, threading rules, and API selection mistakes cause crashes, hangs, and silent failures. ## Core Features & Use Cases - Camera and Microphone Capture: Configure AVCaptureSession with photo, movie, and per-frame sample-buffer outputs, including focus, exposure, torch, and SwiftUI preview integration. - Playback and Editing: Play local and streaming media with AVPlayer and AVQueuePlayer, build edits with AVMutableComposition, and export or transcode with AVAssetExportSession or AVAssetReader/Writer. - Photo Library and Hardware Codecs: Pick media with PHPickerViewController, fetch and cache assets with PhotoKit, and drop to VideoToolbox for hardware-accelerated H.264/HEVC encode and decode. - Use Case: You are building a video recorder app that captures clips, trims and merges them, generates thumbnails, and saves the result to the user's photo library with correct permission handling. ## Quick Start Use the apple-media skill to build an iOS camera screen that records video, trims the clip, and saves it to the photo library.

Frequently Asked Questions about apple-media

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

FAQPage Schema
How do I capture photos and video with AVCaptureSession?

Configure an AVCaptureSession on a dedicated serial queue by adding an AVCaptureDeviceInput for the camera and outputs such as AVCapturePhotoOutput or AVCaptureMovieFileOutput, wrapped in beginConfiguration and commitConfiguration. Call startRunning off the main thread because it blocks.

How do I pick photos without requesting photo library permission?

Use PHPickerViewController in UIKit or PhotosPicker in SwiftUI, which run out of process and require no photo-library authorization. Load results through the item provider or loadTransferable, and only request PHPhotoLibrary authorization when you need direct library access.

When should I use VideoToolbox instead of AVAssetWriter?

Use VideoToolbox only for raw codec access such as real-time streaming, custom container muxing, or RTP transport. For standard file-based transcoding, AVAssetExportSession presets or AVAssetReader and AVAssetWriter are simpler and sufficient.

Why does my app crash when accessing the camera or photo library?

The crash occurs when the required Info.plist usage strings are missing. Add NSCameraUsageDescription, NSMicrophoneUsageDescription, NSPhotoLibraryUsageDescription, or NSPhotoLibraryAddUsageDescription before touching AVCaptureDevice or PHPhotoLibrary, and branch on every authorization status including limited.

Why does AVPlayer stall when loading remote video?

Accessing synchronous properties like asset.duration blocks the main thread on remote assets and is deprecated. Load properties asynchronously with await asset.load(.isPlayable, .duration, .tracks) and observe AVPlayerItem.status before playing.

How do I generate thumbnails from a video efficiently?

Use AVAssetImageGenerator with the async image(at:) or images(for:) APIs, setting requestedTimeToleranceBefore and After to zero for frame accuracy. For photo library grids, request a bounded target size with PHCachingImageManager instead of PHImageManagerMaximumSize to avoid memory spikes.