AVURLAssetPreferPreciseDurationAndTimingKey

Static AVURLAssetPreferPreciseDurationAndTimingKey 

Source
pub unsafe static AVURLAssetPreferPreciseDurationAndTimingKey: &'static NSString
Available on crate feature AVAsset only.
Expand description

Indicates whether the asset should be prepared to indicate a precise duration and provide precise random access by time.

The value for this key is a boolean NSNumber.

If nil is passed as the value of the options parameter to -[AVURLAsset initWithURL:options:], or if a dictionary that lacks a value for the key AVURLAssetPreferPreciseDurationAndTimingKey is passed instead, a default value of NO is assumed. If the asset is intended to be played only, because AVPlayer will support approximate random access by time when full precision isn’t available, the default value of NO will suffice. Pass YES if longer loading times are acceptable in cases in which precise timing is required. If the asset is intended to be inserted into an AVMutableComposition, precise random access is typically desirable and the value of YES is recommended. Note that such precision may require additional parsing of the resource in advance of operations that make use of any portion of it, depending on the specifics of its container format. Many container formats provide sufficient summary information for precise timing and do not require additional parsing to prepare for it; QuickTime movie files and MPEG-4 files are examples of such formats. Other formats do not provide sufficient summary information, and precise random access for them is possible only after a preliminary examination of a file’s contents. If you pass YES for an asset that you intend to play via an instance of AVPlayerItem and you are prepared for playback to commence before the value of -[AVPlayerItem duration] becomes available, you can omit the key “ duration“ from the array of AVAsset keys you pass to -[AVPlayerItem initWithAsset:automaticallyLoadedAssetKeys:] in order to prevent AVPlayerItem from automatically loading the value of duration while the item becomes ready to play. If precise duration and timing is not possible for the timed media resource referenced by the asset’s URL, AVAsset.providesPreciseDurationAndTiming will be NO even if precise timing is requested via the use of this key.

See also Apple’s documentation