Class: AVAsset
Overview
AVAsset is an abstract class to represent timed audiovisual media such as videos and sounds. Each asset contains a collection of tracks that are intended to be presented or processed together, each of a uniform media type, including but not limited to audio, video, text, closed captions, and subtitles.
Direct Known Subclasses
Instance Attribute Summary (collapse)
-
- availableChapterLocales
readonly
The locales available for chapters in the asset.
-
- availableMediaCharacteristicsWithMediaSelectionOptions
readonly
An array of media characteristics for which a media selection option is available.
-
- availableMetadataFormats
readonly
An array of strings, each representing a metadata format that’s available to the asset.
-
- commonMetadata
readonly
An array of metadata items for each common metadata key for which a value is available.
-
- compatibleWithSavedPhotosAlbum
readonly
Indicates whether the asset can be written to the Saved Photos album.
-
- composable
readonly
Indicates whether the asset can be used within a segment of an AVCompositionTrack object.
-
- creationDate
readonly
Indicates the creation date of the asset.
-
- duration
readonly
The duration of the asset.
-
- exportable
readonly
Indicates whether the asset can be exported using AVAssetExportSession.
-
- hasProtectedContent
readonly
Indicates whether the asset has protected content.
-
- lyrics
readonly
The lyrics of the asset suitable for the current locale.
-
- playable
readonly
Indicates whether the asset, or its URL, can be used to initialize an instance of AVPlayerItem.
-
- preferredRate
readonly
The natural rate at which the asset is to be played.
-
- preferredTransform
readonly
The preferred transform to apply to the visual content of the asset for presentation or processing.
-
- preferredVolume
readonly
The preferred volume at which the audible media of asset is to be played.
-
- providesPreciseDurationAndTiming
readonly
Indicates whether the asset provides precise timing.
-
- readable
readonly
Indicates whether the asset’s media data can be extracted using AVAssetReader.
-
- referenceRestrictions
readonly
The reference restrictions being used by the receiver.
-
- tracks
readonly
The tracks contained by the asset.
Class Method Summary (collapse)
-
+ assetWithURL:
Returns an asset for inspection of a media resource.
Instance Method Summary (collapse)
-
- cancelLoading
Cancels the loading of all values for all observers.
-
- chapterMetadataGroupsBestMatchingPreferredLanguages:
Returns an array of chapters whose locale best matches the the list of preferred languages.
-
- chapterMetadataGroupsWithTitleLocale:containingItemsWithCommonKeys:
Returns an array of chapters with a given title locale and containing specified keys.
-
- mediaSelectionGroupForMediaCharacteristic:
Returns an AVMediaSelectionGroup object that contains one or more options with the specified media characteristic.
-
- metadataForFormat:
Returns an array of AVMetadataItem objects, one for each metadata item in the container of the specified format You can filter the array by locale using metadataItemsFromArray:withLocale: (AVMetadataItem) or by key using metadataItemsFromArray:withKey:keySpace: (AVMetadataItem).
-
- tracksWithMediaCharacteristic:
Returns an array of AVAssetTrack objects of the asset that present media with a specified characteristic.
-
- tracksWithMediaType:
Returns an array of the asset tracks of the asset that present media of a specified type.
-
- trackWithTrackID:
Returns the track with a specified track ID.
-
- unusedTrackID
Returns an ID that is currently unused by any of the tracks in the asset.
Methods inherited from NSObject
#!, #!=, #!~, #, #==, #===, #=~, #Rational, #__callee__, #__method__, #__send__, #__type__, `, alloc, allocWithZone:, #autoContentAccessingProxy, autoload, autoload?, autorelease_pool, #awakeAfterUsingCoder:, binding, block_given?, caller, cancelPreviousPerformRequestsWithTarget:, cancelPreviousPerformRequestsWithTarget:selector:object:, catch, class, classFallbacksForKeyedArchiver, #classForCoder, #classForKeyedArchiver, classForKeyedUnarchiver, #clone, conformsToProtocol:, #copy, copyWithZone:, #dealloc, #define_singleton_method, description, display, #doesNotRecognizeSelector:, #dup, #enum_for, #eql?, #equal?, #extend, fail, #finalize, format, #forwardInvocation:, #forwardingTargetForSelector:, framework, #freeze, #frozen?, getpass, gets, global_variables, #init, initialize, #initialize_clone, #initialize_copy, #initialize_dup, #inspect, instanceMethodForSelector:, instanceMethodSignatureForSelector:, #instance_eval, #instance_exec, #instance_of?, #instance_variable_defined?, #instance_variable_get, #instance_variable_set, #instance_variables, instancesRespondToSelector:, isSubclassOfClass:, #is_a?, iterator?, #kind_of?, lambda, load, load_bridge_support_file, load_plist, local_variables, loop, #method, #methodForSelector:, #methodSignatureForSelector:, #methods, #mutableCopy, mutableCopyWithZone:, new, #nil?, open, p, #performSelector:onThread:withObject:waitUntilDone:, #performSelector:onThread:withObject:waitUntilDone:modes:, #performSelector:withObject:afterDelay:, #performSelector:withObject:afterDelay:inModes:, #performSelectorInBackground:withObject:, #performSelectorOnMainThread:withObject:waitUntilDone:, #performSelectorOnMainThread:withObject:waitUntilDone:modes:, print, printf, #private_methods, proc, #protected_methods, #public_method, #public_methods, #public_send, putc, puts, raise, rand, readline, readlines, #replacementObjectForCoder:, #replacementObjectForKeyedArchiver:, require, resolveClassMethod:, resolveInstanceMethod:, #respond_to?, #respond_to_missing?, select, #send, setVersion:, #singleton_methods, sprintf, srand, superclass, #taint, #tainted?, #tap, test, throw, #to_plist, #to_s, trace_var, trap, #trust, #untaint, untrace_var, #untrust, #untrusted?, version
Constructor Details
This class inherits a constructor from NSObject
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class NSObject
Instance Attribute Details
- (Array) availableChapterLocales (readonly)
The locales available for chapters in the asset. (read-only) The array contains instances of NSLocale.
- (Array) availableMediaCharacteristicsWithMediaSelectionOptions (readonly)
An array of media characteristics for which a media selection option is available. (read-only) The value of this property is an array of NSString objects, each string indicating a media characteristic for which a media selection option is available.
- (Array) availableMetadataFormats (readonly)
An array of strings, each representing a metadata format that’s available to the asset. (read-only) Metadata formats may include ID3, iTunes metadata, and so on. For more details, see AVMetadataItem.
- (Array) commonMetadata (readonly)
An array of metadata items for each common metadata key for which a value is available. (read-only) The value is an array of AVMetadataItem objects, one for each metadata key from the common key space for which the asset has an available value. You can filter the array by locale using metadataItemsFromArray:withLocale: (AVMetadataItem) or by key using metadataItemsFromArray:withKey:keySpace: (AVMetadataItem).
- (Boolean) compatibleWithSavedPhotosAlbum (readonly)
Indicates whether the asset can be written to the Saved Photos album. (read-only)
- (Boolean) composable (readonly)
Indicates whether the asset can be used within a segment of an AVCompositionTrack object. (read-only)
- (AVMetadataItem) creationDate (readonly)
Indicates the creation date of the asset. (read-only) The value of this property may be nil.If a creation date has been stored by the asset in a form that can be converted to an NSDate object, the dateValue property of the metadata item will provide an instance of NSDate. Otherwise the creation date is available only as a string value, using the AVMetadataItem stringValue method.
- (CMTime) duration (readonly)
The duration of the asset. (read-only) If providesPreciseDurationAndTiming is NO, a best-available estimate of the duration is returned. You can set the degree of precision required for timing-related properties at initialization time for assets initialized with URLs (see AVURLAssetPreferPreciseDurationAndTimingKey in AVURLAsset).
- (Boolean) exportable (readonly)
Indicates whether the asset can be exported using AVAssetExportSession. (read-only)
- (Boolean) hasProtectedContent (readonly)
Indicates whether the asset has protected content. (read-only)
- (String) lyrics (readonly)
The lyrics of the asset suitable for the current locale. (read-only)
- (Boolean) playable (readonly)
Indicates whether the asset, or its URL, can be used to initialize an instance of AVPlayerItem. (read-only)
- (Float) preferredRate (readonly)
The natural rate at which the asset is to be played. (read-only) This value is often, but not always, 1.0.
- (CGAffineTransform) preferredTransform (readonly)
The preferred transform to apply to the visual content of the asset for presentation or processing. (read-only) The value is often, but not always, the identity transform.
- (Float) preferredVolume (readonly)
The preferred volume at which the audible media of asset is to be played. (read-only) This value is often, but not always, 1.0.
- (Boolean) providesPreciseDurationAndTiming (readonly)
Indicates whether the asset provides precise timing. (read-only) You can set the degree of precision required for timing-related properties at initialization time for assets initialized with URLs (see AVURLAssetPreferPreciseDurationAndTimingKey in AVURLAsset).
- (Boolean) readable (readonly)
Indicates whether the asset’s media data can be extracted using AVAssetReader. (read-only)
- (AVAssetReferenceRestrictions) referenceRestrictions (readonly)
The reference restrictions being used by the receiver. (read-only) For AVURLAsset, this property reflects the value passed in for AVURLAssetReferenceRestrictionsKey, if any.The default value for this property is availableMediaCharacteristicsWithMediaSelectionOptions. See AVURLAssetReferenceRestrictionsKey for a full discussion of reference restrictions.
- (Array) tracks (readonly)
The tracks contained by the asset. (read-only) Tracks are instances of AVAssetTrack.
Class Method Details
+ (Object) assetWithURL(URL)
Returns an asset for inspection of a media resource.
Instance Method Details
- (Object) cancelLoading
Cancels the loading of all values for all observers. Deallocation of an instance of the asset will implicitly invoke this method if any loading requests are still outstanding.
- (Array) chapterMetadataGroupsBestMatchingPreferredLanguages(preferredLanguages)
Returns an array of chapters whose locale best matches the the list of preferred languages. Each object in the returned array contains an AVMetadataItem object representing the chapter title. The time range property of the AVTimedMetadataGroup object is equal to the time range of the chapter title item.All of the available chapter metadata is included in the metadata groups, including items with the common key AVMetadataCommonKeyArtwork, if such items are present. Items not carrying chapter titles are added to an existing AVTimedMetadataGroup object if the time range (timestamp and duration) of the metadata item and that of the metadata group overlaps. The locale of such items need not match the locale of the chapter titles.You can use the metadataItemsFromArray:filteredAndSortedAccordingToPreferredLanguages: method to further filter the metadata items in each group. You can also filter the returned items based on locale using the metadataItemsFromArray:withLocale: method.
- (Array) chapterMetadataGroupsWithTitleLocale(locale, containingItemsWithCommonKeys:commonKeys)
Returns an array of chapters with a given title locale and containing specified keys. Each object in the returned array contains an AVMetadataItem object representing the chapter title, and the time range property of the AVTimedMetadataGroup object is equal to the time range of the chapter title item.An AVMetadataItem with the specified common key is added to an existing AVTimedMetadataGroup object if the time range (timestamp and duration) of the metadata item and the metadata group overlap.The locale of items not carrying chapter titles need not match the specified locale parameter. You can filter the returned items based on locale using metadataItemsFromArray:withLocale:.
- (AVMediaSelectionGroup) mediaSelectionGroupForMediaCharacteristic(mediaCharacteristic)
Returns an AVMediaSelectionGroup object that contains one or more options with the specified media characteristic. You can invoke this method without blocking when the key availableMediaCharacteristicsWithMediaSelectionOptions has been loaded.You can filter the options in the returned media selection group according to playability, locale, and additional media characteristics can be accomplished using the filtering methods defined in the AVMediaSelectionGroup class.
- (Array) metadataForFormat(format)
Returns an array of AVMetadataItem objects, one for each metadata item in the container of the specified format You can filter the array by locale using metadataItemsFromArray:withLocale: (AVMetadataItem) or by key using metadataItemsFromArray:withKey:keySpace: (AVMetadataItem).
- (Array) tracksWithMediaCharacteristic(mediaCharacteristic)
Returns an array of AVAssetTrack objects of the asset that present media with a specified characteristic. You can call this method without blocking when the data in the tracks property is already loaded.
- (Array) tracksWithMediaType(mediaType)
Returns an array of the asset tracks of the asset that present media of a specified type. You can call this method without blocking when the data in the tracks property is already loaded.
- (AVAssetTrack) trackWithTrackID(trackID)
Returns the track with a specified track ID. You can call this method without blocking when the data in the tracks property is already loaded.
- (CMPersistentTrackID) unusedTrackID
Returns an ID that is currently unused by any of the tracks in the asset.