0Pricing
Swift Academy · Lesson

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

  1. Playing Media with AVPlayer
  2. Recording Audio
  3. AVAsset and Composition
  4. Embedding Players in SwiftUI
← Back to Swift Academy