This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Player is a simple iOS/tvOS video player library written in Swift. It provides an easy-to-use API for playing local and streaming media with customizable UI and user interaction.
pod installswift build# Build for iOS
xcodebuild -project Project/Player.xcodeproj -scheme "Player" -sdk iphonesimulator build
# Build for tvOS
xcodebuild -project Project/Player.xcodeproj -scheme "Debug - tvOS" -sdk appletvsimulator build
# Run tests (if available)
xcodebuild -project Project/Player.xcodeproj -scheme "Player" -sdk iphonesimulator test# Generate documentation using jazzy
./build_docs.shThe main library consists of a single Swift file (Sources/Player.swift) that implements the Player class, which:
- Extends
UIViewControllerfor easy integration - Wraps AVFoundation's AVPlayer with a simplified API
- Provides delegate protocols for state management and playback events
- PlayerDelegate: Handles player state changes (ready, buffering, errors)
- PlayerPlaybackDelegate: Manages playback events (time updates, loop events, playback end)
- Local and HTTP streaming media playback
- Customizable video fill modes (resize, aspect fill, aspect fit)
- Playback state management (stopped, playing, paused, failed)
- Buffering state tracking (unknown, ready, delayed)
- Video frame snapshot support
- Automatic retry on network interruptions
- Picture-in-picture support
Project/Player/: iOS sample applicationProject/PlayerTV/: tvOS sample application
- iOS 12.0+
- tvOS 12.0+
- Swift 5.0+
The library has no external dependencies, relying only on iOS/tvOS system frameworks:
- UIKit
- AVFoundation
- CoreGraphics