Instance Property

duration

The duration of the item.

Declaration

@property(readonly) CMTime duration;

Discussion

Indicates the duration of the item, not considering either its forwardPlaybackEndTime or reversePlaybackEndTime.

The value of this property will be reported as kCMTimeIndefinite until the duration of the underlying asset has been loaded. There are two ways to ensure that the value of duration is accessed only after it becomes available:

  • Wait until the status of the player item is AVPlayerItemStatusReadyToPlay.

  • Register for key-value observation of the property, requesting the initial value. If the initial value is reported as kCMTimeIndefinite, the player item will notify you of the availability of its duration via key-value observing as soon as its value becomes known.

See Also

Inspecting a Player Item

asset

The asset provided during initialization.

automaticallyLoadedAssetKeys

The array of asset keys to be automatically loaded before the player item is ready to play.

tracks

An array of player item track objects.

status

The status of the player item.

AVPlayerItemStatus

The statuses for a player item.

timebase

The timebase information for the item.

loadedTimeRanges

An array of time ranges indicating media data that is readily available.

presentationSize

The size at which the visual portion of the item is presented by the player.

timedMetadata

An array of the most recently encountered timed metadata.

Deprecated
error

The error that caused the player item to fail.