AVAsset and Composition
Inspect and combine media tracks.
AVAsset Represents Media
AVAsset models a piece of timed media—its tracks, duration, and metadata—without committing to playback. It is the foundation for editing.
import AVFoundation
let asset = AVURLAsset(url: fileURL)Loading Properties Asynchronously
Asset properties load lazily. Use the async load(_:) API to fetch duration or tracks without blocking.
let duration = try await asset.load(.duration)
let tracks = try await asset.load(.tracks)All lessons in this course
- Playing Media with AVPlayer
- Recording Audio
- AVAsset and Composition
- Embedding Players in SwiftUI