AVAssetTrack Class Reference

Inherits from
Conforms to
Framework
/System/Library/Frameworks/AVFoundation.framework
Availability
Available in iOS 4.0 and later.
Companion guide
Declared in
AVAssetTrack.h
Related sample code

Overview

An AVAssetTrack object provides provides the track-level inspection interface for all assets.

AVAssetTrack adopts the AVAsynchronousKeyValueLoading protocol. You should use methods in the protocol to access a track’s properties without blocking the current thread. To cancel load requests for all keys of AVAssetTrack you must message the parent AVAsset object (for example, [track.asset cancelLoading]).

Tasks

Basic Properties

Temporal Properties

Track Language Properties

Visual Characteristics

Audible Characteristics

Frame-Based Characteristics

Track Segments

Managing Metadata

Properties

asset

The asset of which the track is a part. (read-only)

@property(nonatomic, readonly) AVAsset *asset
Availability
  • Available in iOS 4.0 and later.
Declared In
AVAssetTrack.h

availableMetadataFormats

An array containing the metadata formats available for the track. (read-only)

@property(nonatomic, readonly) NSArray *availableMetadataFormats
Discussion

The array contains NSString objects, one for each metadata format that’s available for the track (such as QuickTime user data). For possible values, see AVMetadataItem.

Availability
  • Available in iOS 4.0 and later.
Declared In
AVAssetTrack.h

commonMetadata

An array of AVMetadataItem objects for each common metadata key for which a value is available. (read-only)

@property(nonatomic, readonly) NSArray *commonMetadata
Availability
  • Available in iOS 4.0 and later.
Declared In
AVAssetTrack.h

enabled

Indicates whether the track is enabled according to state stored in its container or construct. (read-only)

@property(nonatomic, readonly, getter=isEnabled) BOOL enabled
Discussion

You can change the presentation state using AVPlayerItem.

Availability
  • Available in iOS 4.0 and later.
Declared In
AVAssetTrack.h

estimatedDataRate

The estimated data rate of the media data referenced by the track, in bits per second. (read-only)

@property(nonatomic, readonly) float estimatedDataRate
Availability
  • Available in iOS 4.0 and later.
Declared In
AVAssetTrack.h

extendedLanguageTag

The language tag associated with the track, as an RFC 4646 language tag. (read-only)

@property(nonatomic, readonly) NSString *extendedLanguageTag
Discussion

The value may be nil if no language tag is indicated.

Availability
  • Available in iOS 4.0 and later.
Declared In
AVAssetTrack.h

formatDescriptions

The formats of media samples referenced by the track. (read-only)

@property(nonatomic, readonly) NSArray *formatDescriptions
Discussion

The array contains CMFormatDescriptions (see CMFormatDescriptionRef), each of which indicates the format of media samples referenced by the track. A track that presents uniform media (for example, encoded according to the same encoding settings) will provide an array with a count of 1.

Availability
  • Available in iOS 4.0 and later.
Related Sample Code
Declared In
AVAssetTrack.h

languageCode

The language associated with the track, as an ISO 639-2/T language code. (read-only)

@property(nonatomic, readonly) NSString *languageCode
Discussion

The value may be nil if no language is indicated.

Availability
  • Available in iOS 4.0 and later.
Declared In
AVAssetTrack.h

mediaType

The media type for the track. (read-only)

@property(nonatomic, readonly) NSString *mediaType
Discussion

For possible values, see “Media Types” in AV Foundation Constants Reference.

Availability
  • Available in iOS 4.0 and later.
Related Sample Code
Declared In
AVAssetTrack.h

naturalSize

The natural dimensions of the media data referenced by the track. (read-only)

@property(nonatomic, readonly) CGSize naturalSize
Availability
  • Available in iOS 4.0 and later.
Related Sample Code
Declared In
AVAssetTrack.h

naturalTimeScale

A timescale in which time values for the track can be operated upon without extraneous numerical conversion. (read-only)

@property(nonatomic, readonly) CMTimeScale naturalTimeScale
Availability
  • Available in iOS 4.0 and later.
Declared In
AVAssetTrack.h

nominalFrameRate

The frame rate of the track, in frames per second. (read-only)

@property(nonatomic, readonly) float nominalFrameRate
Availability
  • Available in iOS 4.0 and later.
Declared In
AVAssetTrack.h

playable

Indicates whether the track is playable in the current environment. (read-only)

@property(nonatomic, readonly, getter=isPlayable) BOOL playable
Discussion

If the value of this property is YES, an AVPlayerItemTrack of an AVPlayerItem initialized with the the track’s asset can be enabled for playback.

Availability
  • Available in iOS 5.0 and later.
Declared In
AVAssetTrack.h

preferredTransform

The transform specified in the track’s storage container as the preferred transformation of the visual media data for display purposes. (read-only)

@property(nonatomic, readonly) CGAffineTransform preferredTransform
Discussion

The value of this property is often, but not always, CGAffineTransformIdentity.

Availability
  • Available in iOS 4.0 and later.
Related Sample Code
Declared In
AVAssetTrack.h

preferredVolume

The volume specified in the track’s storage container as the preferred volume of the audible media data. (read-only)

@property(nonatomic, readonly) float preferredVolume
Availability
  • Available in iOS 4.0 and later.
Declared In
AVAssetTrack.h

segments

The time mappings from the track’s media samples to the timeline of the track. (read-only)

@property(nonatomic, copy, readonly) NSArray *segments
Discussion

The array contains instances of AVAssetTrackSegment.

Empty edits (that is, time ranges for which no media data is available to be presented) have source.start and source.duration equal to kCMTimeInvalid.

Availability
  • Available in iOS 4.0 and later.
Declared In
AVAssetTrack.h

selfContained

Indicates whether the track references sample data only within its storage container. (read-only)

@property(nonatomic, readonly, getter=isSelfContained) BOOL selfContained
Discussion

The value is YES if the track references sample data only within its storage container, otherwise it is NO.

Availability
  • Available in iOS 4.0 and later.
Declared In
AVAssetTrack.h

timeRange

The time range of the track within the overall timeline of the asset. (read-only)

@property(nonatomic, readonly) CMTimeRange timeRange
Discussion

A track with CMTimeCompare(timeRange.start, kCMTimeZero) == 1 will initially present an empty time range.

Availability
  • Available in iOS 4.0 and later.
Declared In
AVAssetTrack.h

totalSampleDataLength

The total number of bytes of sample data required by the track. (read-only)

@property(nonatomic, readonly) long long totalSampleDataLength
Availability
  • Available in iOS 4.0 and later.
Declared In
AVAssetTrack.h

trackID

The persistent unique identifier for this track of the asset. (read-only)

@property(nonatomic, readonly) CMPersistentTrackID trackID
Availability
  • Available in iOS 4.0 and later.
Declared In
AVAssetTrack.h

Instance Methods

hasMediaCharacteristic:

Returns a Boolean value that indicates whether the track references media with the specified media characteristic.

- (BOOL)hasMediaCharacteristic:(NSString *)mediaCharacteristic
Parameters
mediaCharacteristic

The media characteristic of interest.

For possible values, see “Media Characteristics” in AV Foundation Constants Reference, for example AVMediaCharacteristicVisual, AVMediaCharacteristicAudible, or AVMediaCharacteristicLegible.

Return Value

YES if the track references media with the specified characteristic, otherwise NO.

Availability
  • Available in iOS 4.0 and later.
Declared In
AVAssetTrack.h

metadataForFormat:

An array of metadata items, one for each metadata item in the container of the specified format.

- (NSArray *)metadataForFormat:(NSString *)format
Parameters
format

The metadata format for which items are requested.

Return Value

An array of AVMetadataItem objects, one for each metadata item in the container of the format specified by format, or nil if there is no metadata of the specified format.

Discussion

You can call this method without blocking after availableMetadataFormats has been loaded.

Availability
  • Available in iOS 4.0 and later.
Declared In
AVAssetTrack.h

samplePresentationTimeForTrackTime:

Maps the specified track time through the appropriate time mapping and returns the resulting sample presentation time.

- (CMTime)samplePresentationTimeForTrackTime:(CMTime)trackTime
Parameters
trackTime

The track time for which a sample presentation time is requested.

Return Value

The sample presentation time corresponding to trackTime; the value will be invalid if trackTime is out of range.

Availability
  • Available in iOS 4.0 and later.
Declared In
AVAssetTrack.h

segmentForTrackTime:

The track segment that corresponds to the specified track time.

- (AVAssetTrackSegment *)segmentForTrackTime:(CMTime)trackTime
Parameters
trackTime

The track time for which you want the segment.

Return Value

The track segment from the segments array that corresponds to trackTime, or nil if trackTime is out of range.

Availability
  • Available in iOS 4.0 and later.
Declared In
AVAssetTrack.h

Did this document help you? Yes It's good, but... Not helpful...