AVURLAsset Class Reference
| Inherits from | |
| Conforms to | |
| Framework | /System/Library/Frameworks/AVFoundation.framework |
| Availability | Available in iOS 4.0 and later. |
| Declared in | AVAsset.h |
Overview
AVURLAsset is a concrete subclass of AVAsset that you use to initialize an asset from an URL.
Tasks
Creating an URL Asset
Accessing the URL
-
URLproperty
Accessing the Resource Loader
-
resourceLoaderproperty
Finding Compatible Tracks
Getting Supported Media Types
Properties
resourceLoader
The resource loader associated with the asset. (read-only)
Discussion
During loading, the resource loader object may be asked to assist in the loading of a resource. For example, a resource that requires decryption might result in the resource loader being asked to provide the appropriate decryption keys. You can assign a delegate object to the resource loader object and use your delegate to intercept these requests and provide an appropriate response.
Availability
- Available in iOS 6.0 and later.
Declared In
AVAsset.hURL
The URL with which the asset was initialized. (read-only)
Availability
- Available in iOS 4.0 and later.
Declared In
AVAsset.hClass Methods
audiovisualMIMETypes
Returns an array of the MIME types the AVURLAsset class understands.
Return Value
An array of strings containing MIME types the AVURLAsset class understands.
Availability
- Available in iOS 5.0 and later.
Declared In
AVAsset.haudiovisualTypes
Returns an array of the file types the AVURLAsset class understands.
Return Value
An array of strings containing UTIs identifying the file types the AVURLAsset class understands.
Availability
- Available in iOS 5.0 and later.
Declared In
AVAsset.hisPlayableExtendedMIMEType:
Returns a Boolean value that indicates whether the asset is playable with the given codec(s) and container type.
Parameters
- extendedMIMEType
An extended MIME type.
Return Value
YES if the asset is playable with the codec(s) and container type specified in extendedMIMEType, otherwise NO.
Availability
- Available in iOS 5.0 and later.
Declared In
AVAsset.hURLAssetWithURL:options:
Returns an asset for inspection of a resource referenced by a given URL.
Parameters
- URL
An URL that references the container file to be represented by the asset.
- options
A dictionary that contains options for the initialization of the asset.
For possible keys and values, see “Initialization Options.”
Return Value
An asset initialized for inspection of a resource referenced by URL.
Availability
- Available in iOS 4.0 and later.
See Also
Declared In
AVAsset.hInstance Methods
compatibleTrackForCompositionTrack:
Returns an asset track from which any time range can be inserted into a given composition track.
Parameters
- compositionTrack
The composition track for which a compatible
AVAssetTrackobject is requested.
Return Value
An asset track managed by the receiver from which any time range can be inserted into a given composition track.
Discussion
You insert the track into using insertTimeRange:ofTrack:atTime:error: (AVMutableCompositionTrack). This method is the logical complement of mutableTrackCompatibleWithTrack:.
Availability
- Available in iOS 4.0 and later.
Declared In
AVAsset.hinitWithURL:options:
Initializes an asset for inspection of a resource referenced by a given URL.
Parameters
- URL
An URL that references the container file to be represented by the asset.
- options
A dictionary that contains options for the initialization of the asset.
For possible keys and values, see “Initialization Options.”
Return Value
An asset initialized for inspection of a resource referenced by URL.
Availability
- Available in iOS 4.0 and later.
See Also
Declared In
AVAsset.hConstants
Initialization Options
Keys for options dictionary for use with initWithURL:options: and URLAssetWithURL:options:.
NSString *const AVURLAssetPreferPreciseDurationAndTimingKey; NSString *const AVURLAssetReferenceRestrictionsKey;
Constants
AVURLAssetPreferPreciseDurationAndTimingKeyThe corresponding value is a boolean, contained in an
NSValueobject, that indicates whether the asset should be prepared to indicate a precise duration and provide precise random access by time.YESindicates that longer loading times are acceptable in cases in which precise timing is required. Such precision, however, 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 only intend that the asset be played, the default value of
NOwill suffice (becauseAVPlayersupports approximate random access by time when full precision isn't available). If you intend to insert the asset into anAVMutableCompositionobject, precise random access is typically desirable, and the value ofYESis recommended.Available in iOS 4.0 and later.
Declared in
AVAsset.h.AVURLAssetReferenceRestrictionsKeyThe corresponding value is a an
NSNumberwrapping an “AVAssetReferenceRestrictions” enum value or the logical combination of multiple such values indicating the restrictions used by the asset when resolving references to external media data.Some assets can contain references to media data stored outside the asset’s container file, for example in another file. You can use this key to specify a policy to use when these references are encountered. If an asset contains one or more references of a type that is forbidden by the reference restrictions, loading of asset properties will fail. In addition, such an asset cannot be used with other AVFoundation objects, such as
AVPlayerItemorAVAssetExportSession.Available in iOS 5.0 and later.
Declared in
AVAsset.h.
AVAssetReferenceRestrictions
These constants can be passed in to AVURLAssetReferenceRestrictionsKey to control the resolution of references to external media data.
enum {
AVAssetReferenceRestrictionForbidNone = 0UL,
AVAssetReferenceRestrictionForbidRemoteReferenceToLocal = (1UL << 0),
AVAssetReferenceRestrictionForbidLocalReferenceToRemote = (1UL << 1),
AVAssetReferenceRestrictionForbidCrossSiteReference = (1UL << 2),
AVAssetReferenceRestrictionForbidLocalReferenceToLocal = (1UL << 3),
AVAssetReferenceRestrictionForbidAll = 0xFFFFUL,
};
typedef NSUInteger AVAssetReferenceRestrictions;
Constants
AVAssetReferenceRestrictionForbidNoneIndicates that all types of references should be followed.
Available in iOS 5.0 and later.
Declared in
AVAsset.h.AVAssetReferenceRestrictionForbidRemoteReferenceToLocalIndicates that references from a remote asset (for example, referenced via http URL) to local media data (for example, stored in a local file) should not be followed.
Available in iOS 5.0 and later.
Declared in
AVAsset.h.AVAssetReferenceRestrictionForbidLocalReferenceToRemoteIndicates that references from a local asset to remote media data should not be followed.
Available in iOS 5.0 and later.
Declared in
AVAsset.h.AVAssetReferenceRestrictionForbidCrossSiteReferenceIndicates that references from a remote asset to remote media data stored at a different site should not be followed.
Available in iOS 5.0 and later.
Declared in
AVAsset.h.AVAssetReferenceRestrictionForbidLocalReferenceToLocalIndicates that references from a local asset to local media data stored outside the asset’s container file should not be followed.
Available in iOS 5.0 and later.
Declared in
AVAsset.h.AVAssetReferenceRestrictionForbidAllIndicates that only references to media data stored within the asset’s container file should be allowed.
Available in iOS 5.0 and later.
Declared in
AVAsset.h.
© 2012 Apple Inc. All Rights Reserved. (Last updated: 2012-09-19)