#[repr(C)]pub struct AVURLAsset { /* private fields */ }AVAsset only.Expand description
Implementations§
Source§impl AVURLAsset
impl AVURLAsset
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>
pub unsafe fn new() -> Retained<Self>
Sourcepub unsafe fn audiovisualTypes() -> Retained<NSArray<AVFileType>>
Available on crate feature AVMediaFormat only.
pub unsafe fn audiovisualTypes() -> Retained<NSArray<AVFileType>>
AVMediaFormat only.Provides the file types the AVURLAsset class understands.
Returns: An NSArray of UTIs identifying the file types the AVURLAsset class understands.
Sourcepub unsafe fn audiovisualMIMETypes() -> Retained<NSArray<NSString>>
pub unsafe fn audiovisualMIMETypes() -> Retained<NSArray<NSString>>
Provides the MIME types the AVURLAsset class understands.
Returns: An NSArray of NSStrings containing MIME types the AVURLAsset class understands.
Sourcepub unsafe fn isPlayableExtendedMIMEType(extended_mime_type: &NSString) -> bool
pub unsafe fn isPlayableExtendedMIMEType(extended_mime_type: &NSString) -> bool
Returns YES if asset is playable with the codec(s) and container type specified in extendedMIMEType. Returns NO otherwise.
Parameter extendedMIMEType:
Returns: YES or NO.
On releases prior to macOS 14, iOS 17, tvOS 17, and watchOS 10, regardless of the specified MIME type this method interprets all codecs parameters according to the ISO family syntax defined by RFC 6381 and evaluates playability according to whether the indicated codecs are supported when carried in container formats that conform to the ISO BMFF specification, such as the MPEG-4 file format. On releases starting with macOS 14, iOS 17, tvOS 17, and watchOS 10, this method interprets codecs parameters according to the syntax and namespace determined by the specified MIME type and evaluates playability according to whether the indicated codecs are supported when carried in the container format indicated by that MIME type. Codecs parameters for each of the following MIME types are supported: video/mp4 (per RFC 6381, ISO/IEC 14496-15 Annex E, et al), video/quicktime (RFC 6381 et al), video/mp2t (ISO/IEC 13818-1), audio/vnd.wave (RFC 2361), audio/aiff (using the CoreAudio AudioFormatID namespace), audio/x-caf (also using the CoreAudio AudioFormatID namespace), and audio/mpeg (e.g. codecs=“mp3”). MIME types supported as alternatives for the same container formats, e.g audio/mp4, are equivalently treated. If the indicated MIME type defines no supported syntax and namespace for codecs parameters, when any codecs parameter is present this method returns NO.
Sourcepub unsafe fn URLAssetWithURL_options(
url: &NSURL,
options: Option<&NSDictionary<NSString, AnyObject>>,
) -> Retained<Self>
pub unsafe fn URLAssetWithURL_options( url: &NSURL, options: Option<&NSDictionary<NSString, AnyObject>>, ) -> Retained<Self>
Returns an instance of AVURLAsset for inspection of a media resource.
Parameter URL: An instance of NSURL that references a media resource.
Parameter options: An instance of NSDictionary that contains keys for specifying options for the initialization of the AVURLAsset. See AVURLAssetPreferPreciseDurationAndTimingKey and AVURLAssetReferenceRestrictionsKey above.
Returns: An instance of AVURLAsset.
Sourcepub unsafe fn initWithURL_options(
this: Allocated<Self>,
url: &NSURL,
options: Option<&NSDictionary<NSString, AnyObject>>,
) -> Retained<Self>
pub unsafe fn initWithURL_options( this: Allocated<Self>, url: &NSURL, options: Option<&NSDictionary<NSString, AnyObject>>, ) -> Retained<Self>
Initializes an instance of AVURLAsset for inspection of a media resource.
Parameter URL: An instance of NSURL that references a media resource.
Parameter options: An instance of NSDictionary that contains keys for specifying options for the initialization of the AVURLAsset. See AVURLAssetPreferPreciseDurationAndTimingKey and AVURLAssetReferenceRestrictionsKey above.
Returns: An instance of AVURLAsset.
Sourcepub unsafe fn URL(&self) -> Retained<NSURL>
pub unsafe fn URL(&self) -> Retained<NSURL>
Indicates the URL with which the instance of AVURLAsset was initialized.
Sourcepub unsafe fn httpSessionIdentifier(&self) -> Retained<NSUUID>
pub unsafe fn httpSessionIdentifier(&self) -> Retained<NSUUID>
Provides the identifier that’s automatically included in any HTTP request issued on behalf of this asset in the HTTP header field “X-Playback-Session-Id”.
The value is an NSUUID from which the UUID string can be obtained. Note that copies of an AVURLAsset vend an equivalent httpSessionIdentifier.
Source§impl AVURLAsset
Methods declared on superclass AVAsset.
impl AVURLAsset
Methods declared on superclass AVAsset.
Sourcepub unsafe fn assetWithURL(url: &NSURL) -> Retained<Self>
pub unsafe fn assetWithURL(url: &NSURL) -> Retained<Self>
Returns an instance of AVAsset for inspection of a media resource.
Parameter URL: An instance of NSURL that references a media resource.
Returns: An instance of AVAsset.
Returns a newly allocated instance of a subclass of AVAsset initialized with the specified URL.
Source§impl AVURLAsset
AVURLAssetURLHandling.
impl AVURLAsset
AVURLAssetURLHandling.
Sourcepub unsafe fn resourceLoader(&self) -> Retained<AVAssetResourceLoader>
Available on crate feature AVAssetResourceLoader only.
pub unsafe fn resourceLoader(&self) -> Retained<AVAssetResourceLoader>
AVAssetResourceLoader only.Provides access to an instance of AVAssetResourceLoader, which offers limited control over the handling of URLs that may be loaded in the course of performing operations on the asset, such as playback. The loading of file URLs cannot be mediated via use of AVAssetResourceLoader. Note that copies of an AVAsset will vend the same instance of AVAssetResourceLoader.
Source§impl AVURLAsset
AVURLAssetCache.
impl AVURLAsset
AVURLAssetCache.
Sourcepub unsafe fn assetCache(&self) -> Option<Retained<AVAssetCache>>
Available on crate feature AVAssetCache only.
pub unsafe fn assetCache(&self) -> Option<Retained<AVAssetCache>>
AVAssetCache only.Provides access to an instance of AVAssetCache to use for inspection of locally cached media data. Will be nil if an asset has not been configured to store or access media data from disk.
Source§impl AVURLAsset
AVAssetCompositionUtility.
impl AVURLAsset
AVAssetCompositionUtility.
Sourcepub unsafe fn compatibleTrackForCompositionTrack(
&self,
composition_track: &AVCompositionTrack,
) -> Option<Retained<AVAssetTrack>>
👎Deprecated: Use findCompatibleTrackForCompositionTrack:completionHandler: insteadAvailable on crate features AVAssetTrack and AVCompositionTrack only.
pub unsafe fn compatibleTrackForCompositionTrack( &self, composition_track: &AVCompositionTrack, ) -> Option<Retained<AVAssetTrack>>
AVAssetTrack and AVCompositionTrack only.Provides a reference to an AVAssetTrack of the target from which any timeRange can be inserted into a mutable composition track (via -[AVMutableCompositionTrack insertTimeRange:ofTrack:atTime:error:]).
Parameter compositionTrack: The composition track for which a compatible AVAssetTrack is requested.
Returns: an instance of AVAssetTrack
Finds a track of the target with content that can be accommodated by the specified composition track. The logical complement of -[AVMutableComposition mutableTrackCompatibleWithTrack:].
Sourcepub unsafe fn findCompatibleTrackForCompositionTrack_completionHandler(
&self,
composition_track: &AVCompositionTrack,
completion_handler: &Block<dyn Fn(*mut AVAssetTrack, *mut NSError)>,
)
Available on crate features AVAssetTrack and AVCompositionTrack and block2 only.
pub unsafe fn findCompatibleTrackForCompositionTrack_completionHandler( &self, composition_track: &AVCompositionTrack, completion_handler: &Block<dyn Fn(*mut AVAssetTrack, *mut NSError)>, )
AVAssetTrack and AVCompositionTrack and block2 only.Loads a reference to an AVAssetTrack of the target from which any timeRange can be inserted into a mutable composition track (via -[AVMutableCompositionTrack insertTimeRange:ofTrack:atTime:error:]).
Parameter compositionTrack: The composition track for which a compatible AVAssetTrack is requested.
Parameter completionHandler: A block that is invoked when loading is complete, vending an instance of AVAssetTrack or an error.
Finds a track of the target with content that can be accommodated by the specified composition track. The logical complement of -[AVMutableComposition mutableTrackCompatibleWithTrack:].
Source§impl AVURLAsset
AVAssetVariantInspection.
impl AVURLAsset
AVAssetVariantInspection.
Sourcepub unsafe fn variants(&self) -> Retained<NSArray<AVAssetVariant>>
Available on crate feature AVAssetVariant only.
pub unsafe fn variants(&self) -> Retained<NSArray<AVAssetVariant>>
AVAssetVariant only.Provides an array of AVAssetVariants contained in the asset
Some variants may not be playable according to the current device configuration.
impl AVURLAsset
AVURLAssetNSItemProvider. AVURLAssets can be shared through any interface that supports passing NSItemProviders. Note that only AVURLAssets with file URLs can be added to NSItemProviders. Attempting to share assets with non file URLs will result in an error.
AVURLAssets can be retrieved from NSItemProviders by directly requesting an AVURLAsset through -[NSItemProvider loadObjectOfClass:completionHandler:]. Requesting data representations of AVURLAssets is not supported. File representations of AVURLAssets will be sent without copying the underlying media and the receiver will be extended readonly sandbox access to the sender’s original URL until the AVURLAsset is deallocated. Use of NSFileCoordinator and NSFilePresenter is recommended for both the sender and receive to coordinate possible changes in the file’s state once sharing has been completed.
Source§impl AVURLAsset
AVMediaExtension.
impl AVURLAsset
AVMediaExtension.
Sourcepub unsafe fn mediaExtensionProperties(
&self,
) -> Option<Retained<AVMediaExtensionProperties>>
pub unsafe fn mediaExtensionProperties( &self, ) -> Option<Retained<AVMediaExtensionProperties>>
The properties of the MediaExtension format reader for the asset.
If the asset is being decoded using a MediaExtension format reader, this property will return a AVMediaExtensionProperties object describing the extension. If the asset is not being decoded with a MediaExtension format reader, this property will return nil.
Source§impl AVURLAsset
AVURLAssetContentKeyEligibility.
impl AVURLAsset
AVURLAssetContentKeyEligibility.
Sourcepub unsafe fn mayRequireContentKeysForMediaDataProcessing(&self) -> bool
pub unsafe fn mayRequireContentKeysForMediaDataProcessing(&self) -> bool
Allows AVURLAsset to be added as a content key recipient to an AVContentKeySession.
Methods from Deref<Target = AVAsset>§
pub unsafe fn duration(&self) -> CMTime
objc2-core-media only.pub unsafe fn preferredRate(&self) -> c_float
pub unsafe fn preferredVolume(&self) -> c_float
pub unsafe fn preferredTransform(&self) -> CGAffineTransform
objc2-core-foundation only.pub unsafe fn naturalSize(&self) -> CGSize
objc2-core-foundation only.Sourcepub unsafe fn minimumTimeOffsetFromLive(&self) -> CMTime
Available on crate feature objc2-core-media only.
pub unsafe fn minimumTimeOffsetFromLive(&self) -> CMTime
objc2-core-media only.Indicates how close to the latest content in a live stream playback can be sustained.
For non-live assets this value is kCMTimeInvalid.
pub unsafe fn providesPreciseDurationAndTiming(&self) -> bool
Sourcepub unsafe fn cancelLoading(&self)
pub unsafe fn cancelLoading(&self)
Cancels the loading of all values for all observers.
Deallocation or finalization of an instance of AVAsset will implicitly cancel loading if any loading requests are still outstanding.
Sourcepub unsafe fn referenceRestrictions(&self) -> AVAssetReferenceRestrictions
pub unsafe fn referenceRestrictions(&self) -> AVAssetReferenceRestrictions
Indicates the reference restrictions being used by the receiver.
For AVURLAsset, this property reflects the value passed in for AVURLAssetReferenceRestrictionsKey, if any. See AVURLAssetReferenceRestrictionsKey below for a full discussion of reference restrictions. The default value for this property is AVAssetReferenceRestrictionForbidLocalReferenceToRemote.
Sourcepub unsafe fn tracks(&self) -> Retained<NSArray<AVAssetTrack>>
Available on crate feature AVAssetTrack only.
pub unsafe fn tracks(&self) -> Retained<NSArray<AVAssetTrack>>
AVAssetTrack only.Provides the array of AVAssetTracks contained by the asset
Sourcepub unsafe fn trackWithTrackID(
&self,
track_id: CMPersistentTrackID,
) -> Option<Retained<AVAssetTrack>>
👎Deprecated: Use loadTrackWithTrackID:completionHandler: insteadAvailable on crate features AVAssetTrack and objc2-core-media only.
pub unsafe fn trackWithTrackID( &self, track_id: CMPersistentTrackID, ) -> Option<Retained<AVAssetTrack>>
AVAssetTrack and objc2-core-media only.Provides an instance of AVAssetTrack that represents the track of the specified trackID.
Parameter trackID: The trackID of the requested AVAssetTrack.
Returns: An instance of AVAssetTrack; may be nil if no track of the specified trackID is available.
Becomes callable without blocking when the key “ tracks“ has been loaded
Sourcepub unsafe fn loadTrackWithTrackID_completionHandler(
&self,
track_id: CMPersistentTrackID,
completion_handler: &Block<dyn Fn(*mut AVAssetTrack, *mut NSError)>,
)
Available on crate features AVAssetTrack and block2 and objc2-core-media only.
pub unsafe fn loadTrackWithTrackID_completionHandler( &self, track_id: CMPersistentTrackID, completion_handler: &Block<dyn Fn(*mut AVAssetTrack, *mut NSError)>, )
AVAssetTrack and block2 and objc2-core-media only.Loads an instance of AVAssetTrack that represents the track of the specified trackID.
Parameter trackID: The trackID of the requested AVAssetTrack.
Parameter completionHandler: A block that is called when the loading is finished, with either the loaded track (which may be nil if no track of the specified trackID is available) or an error.
Sourcepub unsafe fn tracksWithMediaType(
&self,
media_type: &AVMediaType,
) -> Retained<NSArray<AVAssetTrack>>
👎Deprecated: Use loadTracksWithMediaType:completionHandler: insteadAvailable on crate features AVAssetTrack and AVMediaFormat only.
pub unsafe fn tracksWithMediaType( &self, media_type: &AVMediaType, ) -> Retained<NSArray<AVAssetTrack>>
AVAssetTrack and AVMediaFormat only.Provides an array of AVAssetTracks of the asset that present media of the specified media type.
Parameter mediaType: The media type according to which AVAsset filters its AVAssetTracks. (Media types are defined in AVMediaFormat.h.)
Returns: An NSArray of AVAssetTracks; may be empty if no tracks of the specified media type are available.
Becomes callable without blocking when the key “ tracks“ has been loaded
Sourcepub unsafe fn loadTracksWithMediaType_completionHandler(
&self,
media_type: &AVMediaType,
completion_handler: &Block<dyn Fn(*mut NSArray<AVAssetTrack>, *mut NSError)>,
)
Available on crate features AVAssetTrack and AVMediaFormat and block2 only.
pub unsafe fn loadTracksWithMediaType_completionHandler( &self, media_type: &AVMediaType, completion_handler: &Block<dyn Fn(*mut NSArray<AVAssetTrack>, *mut NSError)>, )
AVAssetTrack and AVMediaFormat and block2 only.Loads an array of AVAssetTracks of the asset that present media of the specified media type.
Parameter mediaType: The media type according to which AVAsset filters its AVAssetTracks. (Media types are defined in AVMediaFormat.h.)
Parameter completionHandler: A block that is called when the loading is finished, with either the loaded tracks (which may be empty if no tracks of the specified media type are available) or an error.
Sourcepub unsafe fn tracksWithMediaCharacteristic(
&self,
media_characteristic: &AVMediaCharacteristic,
) -> Retained<NSArray<AVAssetTrack>>
👎Deprecated: Use loadTracksWithMediaCharacteristic:completionHandler: insteadAvailable on crate features AVAssetTrack and AVMediaFormat only.
pub unsafe fn tracksWithMediaCharacteristic( &self, media_characteristic: &AVMediaCharacteristic, ) -> Retained<NSArray<AVAssetTrack>>
AVAssetTrack and AVMediaFormat only.Provides an array of AVAssetTracks of the asset that present media with the specified characteristic.
Parameter mediaCharacteristic: The media characteristic according to which AVAsset filters its AVAssetTracks. (Media characteristics are defined in AVMediaFormat.h.)
Returns: An NSArray of AVAssetTracks; may be empty if no tracks with the specified characteristic are available.
Becomes callable without blocking when the key “ tracks“ has been loaded
Sourcepub unsafe fn loadTracksWithMediaCharacteristic_completionHandler(
&self,
media_characteristic: &AVMediaCharacteristic,
completion_handler: &Block<dyn Fn(*mut NSArray<AVAssetTrack>, *mut NSError)>,
)
Available on crate features AVAssetTrack and AVMediaFormat and block2 only.
pub unsafe fn loadTracksWithMediaCharacteristic_completionHandler( &self, media_characteristic: &AVMediaCharacteristic, completion_handler: &Block<dyn Fn(*mut NSArray<AVAssetTrack>, *mut NSError)>, )
AVAssetTrack and AVMediaFormat and block2 only.Loads an array of AVAssetTracks of the asset that present media with the specified characteristic.
Parameter mediaCharacteristic: The media characteristic according to which AVAsset filters its AVAssetTracks. (Media characteristics are defined in AVMediaFormat.h.)
Parameter completionHandler: A block that is called when the loading is finished, with either the loaded tracks (which may be empty if no tracks with the specified characteristic are available) or an error.
Sourcepub unsafe fn trackGroups(&self) -> Retained<NSArray<AVAssetTrackGroup>>
Available on crate feature AVAssetTrackGroup only.
pub unsafe fn trackGroups(&self) -> Retained<NSArray<AVAssetTrackGroup>>
AVAssetTrackGroup only.All track groups in the receiver.
The value of this property is an NSArray of AVAssetTrackGroups, each representing a different grouping of tracks in the receiver.
pub unsafe fn creationDate(&self) -> Option<Retained<AVMetadataItem>>
AVMetadataItem only.pub unsafe fn lyrics(&self) -> Option<Retained<NSString>>
pub unsafe fn commonMetadata(&self) -> Retained<NSArray<AVMetadataItem>>
AVMetadataItem only.pub unsafe fn metadata(&self) -> Retained<NSArray<AVMetadataItem>>
AVMetadataItem only.pub unsafe fn availableMetadataFormats( &self, ) -> Retained<NSArray<AVMetadataFormat>>
AVMetadataFormat only.Sourcepub unsafe fn metadataForFormat(
&self,
format: &AVMetadataFormat,
) -> Retained<NSArray<AVMetadataItem>>
👎Deprecated: Use loadMetadataForFormat:completionHandler: insteadAvailable on crate features AVMetadataFormat and AVMetadataItem only.
pub unsafe fn metadataForFormat( &self, format: &AVMetadataFormat, ) -> Retained<NSArray<AVMetadataItem>>
AVMetadataFormat and AVMetadataItem only.Provides an NSArray of AVMetadataItems, one for each metadata item in the container of the specified format; can subsequently be filtered according to language via +[AVMetadataItem metadataItemsFromArray:filteredAndSortedAccordingToPreferredLanguages:], according to locale via +[AVMetadataItem metadataItemsFromArray:withLocale:], or according to key via +[AVMetadataItem metadataItemsFromArray:withKey:keySpace:].
Parameter format: The metadata format for which items are requested.
Returns: An NSArray containing AVMetadataItems; may be empty if there is no metadata of the specified format.
Becomes callable without blocking when the key “ availableMetadataFormats“ has been loaded
Sourcepub unsafe fn loadMetadataForFormat_completionHandler(
&self,
format: &AVMetadataFormat,
completion_handler: &Block<dyn Fn(*mut NSArray<AVMetadataItem>, *mut NSError)>,
)
Available on crate features AVMetadataFormat and AVMetadataItem and block2 only.
pub unsafe fn loadMetadataForFormat_completionHandler( &self, format: &AVMetadataFormat, completion_handler: &Block<dyn Fn(*mut NSArray<AVMetadataItem>, *mut NSError)>, )
AVMetadataFormat and AVMetadataItem and block2 only.Loads an NSArray of AVMetadataItems, one for each metadata item in the container of the specified format; can subsequently be filtered according to language via +[AVMetadataItem metadataItemsFromArray:filteredAndSortedAccordingToPreferredLanguages:], according to locale via +[AVMetadataItem metadataItemsFromArray:withLocale:], or according to key via +[AVMetadataItem metadataItemsFromArray:withKey:keySpace:].
Parameter format: The metadata format for which items are requested.
Parameter completionHandler: A block that is invoked when loading is complete, vending the array of metadata items (which may be empty if there is no metadata of the specified format) or an error.
pub unsafe fn availableChapterLocales(&self) -> Retained<NSArray<NSLocale>>
Sourcepub unsafe fn chapterMetadataGroupsWithTitleLocale_containingItemsWithCommonKeys(
&self,
locale: &NSLocale,
common_keys: Option<&NSArray<AVMetadataKey>>,
) -> Retained<NSArray<AVTimedMetadataGroup>>
👎Deprecated: Use loadChapterMetadataGroupsWithTitleLocale:containingItemsWithCommonKeys:completionHandler: insteadAvailable on crate features AVMetadataFormat and AVTimedMetadataGroup only.
pub unsafe fn chapterMetadataGroupsWithTitleLocale_containingItemsWithCommonKeys( &self, locale: &NSLocale, common_keys: Option<&NSArray<AVMetadataKey>>, ) -> Retained<NSArray<AVTimedMetadataGroup>>
AVMetadataFormat and AVTimedMetadataGroup only.Provides an array of chapters.
Parameter locale: Locale of the metadata items carrying chapter titles to be returned (supports the IETF BCP 47 specification).
Parameter commonKeys: Array of common keys of AVMetadataItem to be included; can be nil.
AVMetadataCommonKeyArtwork is the only supported key for now.
Returns: An NSArray of AVTimedMetadataGroup.
This method returns an array of AVTimedMetadataGroup objects. Each object in the array always contains an AVMetadataItem representing the chapter title; the timeRange property of the AVTimedMetadataGroup object is equal to the time range of the chapter title item.
An AVMetadataItem with the specified common key will be added to an existing AVTimedMetadataGroup object if the time range (timestamp and duration) of the metadata item and the metadata group overlaps. The locale of items not carrying chapter titles need not match the specified locale parameter.
Further filtering of the metadata items in AVTimedMetadataGroups according to language can be accomplished using +[AVMetadataItem metadataItemsFromArray:filteredAndSortedAccordingToPreferredLanguages:]; filtering of the metadata items according to locale can be accomplished using +[AVMetadataItem metadataItemsFromArray:withLocale:].
Sourcepub unsafe fn loadChapterMetadataGroupsWithTitleLocale_containingItemsWithCommonKeys_completionHandler(
&self,
locale: &NSLocale,
common_keys: &NSArray<AVMetadataKey>,
completion_handler: &Block<dyn Fn(*mut NSArray<AVTimedMetadataGroup>, *mut NSError)>,
)
Available on crate features AVMetadataFormat and AVTimedMetadataGroup and block2 only.
pub unsafe fn loadChapterMetadataGroupsWithTitleLocale_containingItemsWithCommonKeys_completionHandler( &self, locale: &NSLocale, common_keys: &NSArray<AVMetadataKey>, completion_handler: &Block<dyn Fn(*mut NSArray<AVTimedMetadataGroup>, *mut NSError)>, )
AVMetadataFormat and AVTimedMetadataGroup and block2 only.Loads an array of chapters.
Parameter locale: Locale of the metadata items carrying chapter titles to be returned (supports the IETF BCP 47 specification).
Parameter commonKeys: Array of common keys of AVMetadataItem to be included; if no common keys are required, send an empty list.
AVMetadataCommonKeyArtwork is the only supported key for now.
Parameter completionHandler: A block that is invoked when loading is complete, vending the array of timed metadata groups or an error.
This method vends an array of AVTimedMetadataGroup objects. Each object in the array always contains an AVMetadataItem representing the chapter title; the timeRange property of the AVTimedMetadataGroup object is equal to the time range of the chapter title item.
An AVMetadataItem with the specified common key will be added to an existing AVTimedMetadataGroup object if the time range (timestamp and duration) of the metadata item and the metadata group overlaps. The locale of items not carrying chapter titles need not match the specified locale parameter.
Further filtering of the metadata items in AVTimedMetadataGroups according to language can be accomplished using +[AVMetadataItem metadataItemsFromArray:filteredAndSortedAccordingToPreferredLanguages:]; filtering of the metadata items according to locale can be accomplished using +[AVMetadataItem metadataItemsFromArray:withLocale:].
Sourcepub unsafe fn chapterMetadataGroupsBestMatchingPreferredLanguages(
&self,
preferred_languages: &NSArray<NSString>,
) -> Retained<NSArray<AVTimedMetadataGroup>>
👎Deprecated: Use loadChapterMetadataGroupsBestMatchingPreferredLanguages:completionHandler: insteadAvailable on crate feature AVTimedMetadataGroup only.
pub unsafe fn chapterMetadataGroupsBestMatchingPreferredLanguages( &self, preferred_languages: &NSArray<NSString>, ) -> Retained<NSArray<AVTimedMetadataGroup>>
AVTimedMetadataGroup only.Tests, in order of preference, for a match between language identifiers in the specified array of preferred languages and the available chapter locales, and returns the array of chapters corresponding to the first match that’s found.
Parameter preferredLanguages: An array of language identifiers in order of preference, each of which is an IETF BCP 47 (RFC 4646) language identifier. Use +[NSLocale preferredLanguages] to obtain the user’s list of preferred languages.
Returns: An NSArray of AVTimedMetadataGroup.
Safe to call without blocking when the AVAsset key availableChapterLocales has status AVKeyValueStatusLoaded.
Returns an array of AVTimedMetadataGroup objects. Each object in the array always contains an AVMetadataItem representing the chapter title; the timeRange 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 will be 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.
Further filtering of the metadata items in AVTimedMetadataGroups according to language can be accomplished using +[AVMetadataItem metadataItemsFromArray:filteredAndSortedAccordingToPreferredLanguages:]; filtering of the metadata items according to locale can be accomplished using +[AVMetadataItem metadataItemsFromArray:withLocale:]. .
Sourcepub unsafe fn loadChapterMetadataGroupsBestMatchingPreferredLanguages_completionHandler(
&self,
preferred_languages: &NSArray<NSString>,
completion_handler: &Block<dyn Fn(*mut NSArray<AVTimedMetadataGroup>, *mut NSError)>,
)
Available on crate features AVTimedMetadataGroup and block2 only.
pub unsafe fn loadChapterMetadataGroupsBestMatchingPreferredLanguages_completionHandler( &self, preferred_languages: &NSArray<NSString>, completion_handler: &Block<dyn Fn(*mut NSArray<AVTimedMetadataGroup>, *mut NSError)>, )
AVTimedMetadataGroup and block2 only.Tests, in order of preference, for a match between language identifiers in the specified array of preferred languages and the available chapter locales, and loads the array of chapters corresponding to the first match that’s found.
Parameter preferredLanguages: An array of language identifiers in order of preference, each of which is an IETF BCP 47 (RFC 4646) language identifier. Use +[NSLocale preferredLanguages] to obtain the user’s list of preferred languages.
Parameter completionHandler: A block that is invoked when loading is complete, vending the array of timed metadata groups or an error.
Returns an array of AVTimedMetadataGroup objects. Each object in the array always contains an AVMetadataItem representing the chapter title; the timeRange 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 will be 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.
Further filtering of the metadata items in AVTimedMetadataGroups according to language can be accomplished using +[AVMetadataItem metadataItemsFromArray:filteredAndSortedAccordingToPreferredLanguages:]; filtering of the metadata items according to locale can be accomplished using +[AVMetadataItem metadataItemsFromArray:withLocale:].
pub unsafe fn availableMediaCharacteristicsWithMediaSelectionOptions( &self, ) -> Retained<NSArray<AVMediaCharacteristic>>
AVMediaFormat only.Sourcepub unsafe fn mediaSelectionGroupForMediaCharacteristic(
&self,
media_characteristic: &AVMediaCharacteristic,
) -> Option<Retained<AVMediaSelectionGroup>>
👎Deprecated: Use loadMediaSelectionGroupForMediaCharacteristic:completionHandler: insteadAvailable on crate features AVMediaFormat and AVMediaSelectionGroup only.
pub unsafe fn mediaSelectionGroupForMediaCharacteristic( &self, media_characteristic: &AVMediaCharacteristic, ) -> Option<Retained<AVMediaSelectionGroup>>
AVMediaFormat and AVMediaSelectionGroup only.Provides an instance of AVMediaSelectionGroup that contains one or more options with the specified media characteristic.
Parameter mediaCharacteristic: A media characteristic for which you wish to obtain the available media selection options. AVMediaCharacteristicAudible, AVMediaCharacteristicLegible, and AVMediaCharacteristicVisual are currently supported.
Pass AVMediaCharacteristicAudible to obtain the group of available options for audio media in various languages and for various purposes, such as descriptive audio. Pass AVMediaCharacteristicLegible to obtain the group of available options for subtitles in various languages and for various purposes. Pass AVMediaCharacteristicVisual to obtain the group of available options for video media.
Returns: An instance of AVMediaSelectionGroup. May be nil.
Becomes callable without blocking when the key “ availableMediaCharacteristicsWithMediaSelectionOptions“ has been loaded.
If the asset has no AVMediaSelectionGroup containing options with the specified media characteristic, the return value will be nil.
Filtering of the options in the returned AVMediaSelectionGroup according to playability, locale, and additional media characteristics can be accomplished using the category AVMediaSelectionOptionFiltering defined on AVMediaSelectionGroup.
Sourcepub unsafe fn loadMediaSelectionGroupForMediaCharacteristic_completionHandler(
&self,
media_characteristic: &AVMediaCharacteristic,
completion_handler: &Block<dyn Fn(*mut AVMediaSelectionGroup, *mut NSError)>,
)
Available on crate features AVMediaFormat and AVMediaSelectionGroup and block2 only.
pub unsafe fn loadMediaSelectionGroupForMediaCharacteristic_completionHandler( &self, media_characteristic: &AVMediaCharacteristic, completion_handler: &Block<dyn Fn(*mut AVMediaSelectionGroup, *mut NSError)>, )
AVMediaFormat and AVMediaSelectionGroup and block2 only.Loads an instance of AVMediaSelectionGroup that contains one or more options with the specified media characteristic.
Parameter mediaCharacteristic: A media characteristic for which you wish to obtain the available media selection options. AVMediaCharacteristicAudible, AVMediaCharacteristicLegible, and AVMediaCharacteristicVisual are currently supported.
Pass AVMediaCharacteristicAudible to obtain the group of available options for audio media in various languages and for various purposes, such as descriptive audio. Pass AVMediaCharacteristicLegible to obtain the group of available options for subtitles in various languages and for various purposes. Pass AVMediaCharacteristicVisual to obtain the group of available options for video media.
Parameter completionHandler: A block that is invoked when loading is complete, vending an instance of AVMediaSelectionGroup (which may be nil) or an error.
If the asset has no AVMediaSelectionGroup containing options with the specified media characteristic, the return value will be nil.
Filtering of the options in the returned AVMediaSelectionGroup according to playability, locale, and additional media characteristics can be accomplished using the category AVMediaSelectionOptionFiltering defined on AVMediaSelectionGroup.
Sourcepub unsafe fn preferredMediaSelection(&self) -> Retained<AVMediaSelection>
Available on crate feature AVMediaSelection only.
pub unsafe fn preferredMediaSelection(&self) -> Retained<AVMediaSelection>
AVMediaSelection only.Provides an instance of AVMediaSelection with default selections for each of the receiver’s media selection groups.
Sourcepub unsafe fn allMediaSelections(&self) -> Retained<NSArray<AVMediaSelection>>
Available on crate feature AVMediaSelection only.
pub unsafe fn allMediaSelections(&self) -> Retained<NSArray<AVMediaSelection>>
AVMediaSelection only.Provides an array of all permutations of AVMediaSelection for this asset.
Sourcepub unsafe fn hasProtectedContent(&self) -> bool
pub unsafe fn hasProtectedContent(&self) -> bool
Indicates whether or not the asset has protected content.
Assets containing protected content may not be playable without successful authorization, even if the value of the “playable” property is YES. See the properties in the AVAssetUsability category for details on how such an asset may be used. On macOS, clients can use the interfaces in AVPlayerItemProtectedContentAdditions.h to request authorization to play the asset.
Sourcepub unsafe fn canContainFragments(&self) -> bool
pub unsafe fn canContainFragments(&self) -> bool
Indicates whether the asset is capable of being extended by fragments.
For QuickTime movie files and MPEG-4 files, the value of canContainFragments is YES if an ‘mvex’ box is present in the ‘moov’ box. For those types, the ‘mvex’ box signals the possible presence of later ‘moof’ boxes.
Sourcepub unsafe fn containsFragments(&self) -> bool
pub unsafe fn containsFragments(&self) -> bool
Indicates whether the asset is extended by at least one fragment.
For QuickTime movie files and MPEG-4 files, the value of this property is YES if canContainFragments is YES and at least one ‘moof’ box is present after the ‘moov’ box.
Sourcepub unsafe fn overallDurationHint(&self) -> CMTime
Available on crate feature objc2-core-media only.
pub unsafe fn overallDurationHint(&self) -> CMTime
objc2-core-media only.Indicates the total duration of fragments that either exist now or may be appended in the future in order to extend the duration of the asset.
For QuickTime movie files and MPEG-4 files, the value of this property is obtained from the ‘mehd’ box of the ‘mvex’ box, if present. If no total fragment duration hint is available, the value of this property is kCMTimeInvalid.
Sourcepub unsafe fn isPlayable(&self) -> bool
pub unsafe fn isPlayable(&self) -> bool
Indicates whether an AVPlayer can play the contents of the asset in a manner that meets user expectations.
A client can attempt playback when playable is NO, this however may lead to a substandard playback experience.
pub unsafe fn isExportable(&self) -> bool
pub unsafe fn isReadable(&self) -> bool
pub unsafe fn isComposable(&self) -> bool
pub unsafe fn isCompatibleWithSavedPhotosAlbum(&self) -> bool
Sourcepub unsafe fn isCompatibleWithAirPlayVideo(&self) -> bool
pub unsafe fn isCompatibleWithAirPlayVideo(&self) -> bool
Indicates whether the asset is compatible with AirPlay Video.
YES if an AVPlayerItem initialized with the receiver can be played by an external device via AirPlay Video.
pub unsafe fn unusedTrackID(&self) -> CMPersistentTrackID
AVVideoComposition and objc2-core-media only.Sourcepub unsafe fn findUnusedTrackIDWithCompletionHandler(
&self,
completion_handler: &Block<dyn Fn(CMPersistentTrackID, *mut NSError)>,
)
Available on crate features AVVideoComposition and block2 and objc2-core-media only.
pub unsafe fn findUnusedTrackIDWithCompletionHandler( &self, completion_handler: &Block<dyn Fn(CMPersistentTrackID, *mut NSError)>, )
AVVideoComposition and block2 and objc2-core-media only.Loads a track ID that will not collide with any existing track
Parameter completionHandler: A block that is invoked when loading is complete, vending the track ID or an error.
Methods from Deref<Target = NSObject>§
Sourcepub fn doesNotRecognizeSelector(&self, sel: Sel) -> !
pub fn doesNotRecognizeSelector(&self, sel: Sel) -> !
Handle messages the object doesn’t recognize.
See Apple’s documentation for details.
Methods from Deref<Target = AnyObject>§
Sourcepub fn class(&self) -> &'static AnyClass
pub fn class(&self) -> &'static AnyClass
Dynamically find the class of this object.
§Example
Check that an instance of NSObject has the precise class NSObject.
use objc2::ClassType;
use objc2::runtime::NSObject;
let obj = NSObject::new();
assert_eq!(obj.class(), NSObject::class());Sourcepub unsafe fn get_ivar<T>(&self, name: &str) -> &Twhere
T: Encode,
👎Deprecated: this is difficult to use correctly, use Ivar::load instead.
pub unsafe fn get_ivar<T>(&self, name: &str) -> &Twhere
T: Encode,
Ivar::load instead.Use Ivar::load instead.
§Safety
The object must have an instance variable with the given name, and it
must be of type T.
See Ivar::load_ptr for details surrounding this.
Sourcepub fn downcast_ref<T>(&self) -> Option<&T>where
T: DowncastTarget,
pub fn downcast_ref<T>(&self) -> Option<&T>where
T: DowncastTarget,
Attempt to downcast the object to a class of type T.
This is the reference-variant. Use Retained::downcast if you want
to convert a retained object to another type.
§Mutable classes
Some classes have immutable and mutable variants, such as NSString
and NSMutableString.
When some Objective-C API signature says it gives you an immutable class, it generally expects you to not mutate that, even though it may technically be mutable “under the hood”.
So using this method to convert a NSString to a NSMutableString,
while not unsound, is generally frowned upon unless you created the
string yourself, or the API explicitly documents the string to be
mutable.
See Apple’s documentation on mutability and on
isKindOfClass: for more details.
§Generic classes
Objective-C generics are called “lightweight generics”, and that’s because they aren’t exposed in the runtime. This makes it impossible to safely downcast to generic collections, so this is disallowed by this method.
You can, however, safely downcast to generic collections where all the
type-parameters are AnyObject.
§Panics
This works internally by calling isKindOfClass:. That means that the
object must have the instance method of that name, and an exception
will be thrown (if CoreFoundation is linked) or the process will abort
if that is not the case. In the vast majority of cases, you don’t need
to worry about this, since both root objects NSObject and
NSProxy implement this method.
§Examples
Cast an NSString back and forth from NSObject.
use objc2::rc::Retained;
use objc2_foundation::{NSObject, NSString};
let obj: Retained<NSObject> = NSString::new().into_super();
let string = obj.downcast_ref::<NSString>().unwrap();
// Or with `downcast`, if we do not need the object afterwards
let string = obj.downcast::<NSString>().unwrap();Try (and fail) to cast an NSObject to an NSString.
use objc2_foundation::{NSObject, NSString};
let obj = NSObject::new();
assert!(obj.downcast_ref::<NSString>().is_none());Try to cast to an array of strings.
use objc2_foundation::{NSArray, NSObject, NSString};
let arr = NSArray::from_retained_slice(&[NSObject::new()]);
// This is invalid and doesn't type check.
let arr = arr.downcast_ref::<NSArray<NSString>>();This fails to compile, since it would require enumerating over the array to ensure that each element is of the desired type, which is a performance pitfall.
Downcast when processing each element instead.
use objc2_foundation::{NSArray, NSObject, NSString};
let arr = NSArray::from_retained_slice(&[NSObject::new()]);
for elem in arr {
if let Some(data) = elem.downcast_ref::<NSString>() {
// handle `data`
}
}Trait Implementations§
Source§impl AVAsynchronousKeyValueLoading for AVURLAsset
Available on crate feature AVAsynchronousKeyValueLoading only.
impl AVAsynchronousKeyValueLoading for AVURLAsset
AVAsynchronousKeyValueLoading only.Source§impl AVContentKeyRecipient for AVURLAsset
Available on crate feature AVContentKeySession only.
impl AVContentKeyRecipient for AVURLAsset
AVContentKeySession only.Source§unsafe fn contentKeySession_didProvideContentKey(
&self,
content_key_session: &AVContentKeySession,
content_key: &AVContentKey,
)
unsafe fn contentKeySession_didProvideContentKey( &self, content_key_session: &AVContentKeySession, content_key: &AVContentKey, )
Source§impl AsRef<AVAsset> for AVURLAsset
impl AsRef<AVAsset> for AVURLAsset
Source§impl AsRef<AVURLAsset> for AVFragmentedAsset
impl AsRef<AVURLAsset> for AVFragmentedAsset
Source§fn as_ref(&self) -> &AVURLAsset
fn as_ref(&self) -> &AVURLAsset
Source§impl AsRef<AVURLAsset> for AVURLAsset
impl AsRef<AVURLAsset> for AVURLAsset
Source§impl AsRef<AnyObject> for AVURLAsset
impl AsRef<AnyObject> for AVURLAsset
Source§impl AsRef<NSObject> for AVURLAsset
impl AsRef<NSObject> for AVURLAsset
Source§impl Borrow<AVAsset> for AVURLAsset
impl Borrow<AVAsset> for AVURLAsset
Source§impl Borrow<AVURLAsset> for AVFragmentedAsset
impl Borrow<AVURLAsset> for AVFragmentedAsset
Source§fn borrow(&self) -> &AVURLAsset
fn borrow(&self) -> &AVURLAsset
Source§impl Borrow<AnyObject> for AVURLAsset
impl Borrow<AnyObject> for AVURLAsset
Source§impl Borrow<NSObject> for AVURLAsset
impl Borrow<NSObject> for AVURLAsset
Source§impl ClassType for AVURLAsset
impl ClassType for AVURLAsset
Source§const NAME: &'static str = "AVURLAsset"
const NAME: &'static str = "AVURLAsset"
Source§type ThreadKind = <<AVURLAsset as ClassType>::Super as ClassType>::ThreadKind
type ThreadKind = <<AVURLAsset as ClassType>::Super as ClassType>::ThreadKind
Source§impl CopyingHelper for AVURLAsset
impl CopyingHelper for AVURLAsset
Source§type Result = AVURLAsset
type Result = AVURLAsset
Self if the type has no
immutable counterpart. Read moreSource§impl Debug for AVURLAsset
impl Debug for AVURLAsset
Source§impl Deref for AVURLAsset
impl Deref for AVURLAsset
Source§impl Hash for AVURLAsset
impl Hash for AVURLAsset
Source§impl Message for AVURLAsset
impl Message for AVURLAsset
Source§impl NSCopying for AVURLAsset
impl NSCopying for AVURLAsset
Source§impl NSItemProviderReading for AVURLAsset
impl NSItemProviderReading for AVURLAsset
Source§impl NSItemProviderWriting for AVURLAsset
impl NSItemProviderWriting for AVURLAsset
Source§unsafe fn writableTypeIdentifiersForItemProvider_class() -> Retained<NSArray<NSString>>
unsafe fn writableTypeIdentifiersForItemProvider_class() -> Retained<NSArray<NSString>>
NSArray and NSString only.Source§unsafe fn writableTypeIdentifiersForItemProvider(
&self,
) -> Retained<NSArray<NSString>>
unsafe fn writableTypeIdentifiersForItemProvider( &self, ) -> Retained<NSArray<NSString>>
NSArray and NSString only.Source§unsafe fn itemProviderVisibilityForRepresentationWithTypeIdentifier_class(
type_identifier: &NSString,
) -> NSItemProviderRepresentationVisibility
unsafe fn itemProviderVisibilityForRepresentationWithTypeIdentifier_class( type_identifier: &NSString, ) -> NSItemProviderRepresentationVisibility
NSString only.Source§unsafe fn itemProviderVisibilityForRepresentationWithTypeIdentifier(
&self,
type_identifier: &NSString,
) -> NSItemProviderRepresentationVisibility
unsafe fn itemProviderVisibilityForRepresentationWithTypeIdentifier( &self, type_identifier: &NSString, ) -> NSItemProviderRepresentationVisibility
NSString only.Source§impl NSObjectProtocol for AVURLAsset
impl NSObjectProtocol for AVURLAsset
Source§fn isEqual(&self, other: Option<&AnyObject>) -> bool
fn isEqual(&self, other: Option<&AnyObject>) -> bool
Source§fn hash(&self) -> usize
fn hash(&self) -> usize
Source§fn isKindOfClass(&self, cls: &AnyClass) -> bool
fn isKindOfClass(&self, cls: &AnyClass) -> bool
Source§fn is_kind_of<T>(&self) -> bool
fn is_kind_of<T>(&self) -> bool
isKindOfClass directly, or cast your objects with AnyObject::downcast_ref