Class

AVAssetReader

A reader object used to obtain the media data of an asset, either file-based or consisting of an assemblage of media data from multiple sources.

Declaration

@interface AVAssetReader : NSObject

Overview

AVAssetReader lets you:

The AVAssetReader pipelines are multithreaded internally. After you initiate reading with initWithAsset:error:, a reader loads and processes a reasonable amount of sample data ahead of use so that retrieval operations such as copyNextSampleBuffer (AVAssetReaderOutput) can have very low latency. AVAssetReader is not intended for use with real-time sources, and its performance is not guaranteed for real-time operations.

Topics

Creating a Reader

- initWithAsset:error:

Creates an asset reader for reading media data from a specified asset.

+ assetReaderWithAsset:error:

Returns an asset reader for reading media data from a specified asset.

Managing Outputs

outputs

The outputs from which clients of the reader can read media data.

- addOutput:

Adds an output to the receiver.

- canAddOutput:

Returns a Boolean value that indicates whether to add an output to the receiver.

Controlling Reading

status

The status of the reading of sample buffers from the asset.

AVAssetReaderStatus

The statuses for a reader.

- startReading

Prepares the receiver for obtaining sample buffers from the asset.

- cancelReading

Cancels any background work and prevents the receiver’s outputs from reading more samples.

error

Describes the error that occurred.

timeRange

The time range to read from the asset.

Getting the Asset

asset

The asset that initialized the receiver.

Relationships

Inherits From

See Also

File Import

AVAssetReaderAudioMixOutput

An object that defines an interface for reading audio samples that result from mixing the audio from one or more tracks.

AVAssetReaderTrackOutput

An object that defines an interface for reading media data from a single track of an asset reader's asset.

AVAssetReaderSampleReferenceOutput

An object that defines an interface for reading sample references from a single asset track.

AVAssetReaderVideoCompositionOutput

An object that reads video frames composited from the frames in one or more tracks of a reader's assets.

AVAssetReaderOutput

An abstract class that defines an interface for reading a single collection of samples of a common media type from an asset reader object.

AVAssetReaderOutputMetadataAdaptor

An object that defines an interface for reading metadata.

AVAssetImageGenerator

An object that provides thumbnail or preview images of assets independently of playback.