pub struct AVAssetDownloadConfiguration { /* private fields */ }AVAssetDownloadTask only.Expand description
Configuration parameters for the download task.
Download configuration consists of primary and auxiliary content configurations. Primary content configuration represents the primary set of renditions essential for offline playback. Auxiliary content configurations represent additional configurations to complement the primary. For example, the primary content configuration may represent stereo audio renditions and auxiliary configuration may represent complementing multichannel audio renditions.
It is important to configure your download configuration object appropriately before using it to create a download task. Download task makes a copy of the configuration settings you provide and use those settings to configure the task. Once configured, the task object ignores any changes you make to the NSURLSessionConfiguration object. If you need to modify your settings, you must update the download configuration object and use it to create a new download task object.
See also Apple’s documentation
Implementations§
Source§impl AVAssetDownloadConfiguration
impl AVAssetDownloadConfiguration
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>
pub unsafe fn new() -> Retained<Self>
Sourcepub unsafe fn downloadConfigurationWithAsset_title(
asset: &AVURLAsset,
title: &NSString,
) -> Retained<Self>
Available on crate feature AVAsset only.
pub unsafe fn downloadConfigurationWithAsset_title( asset: &AVURLAsset, title: &NSString, ) -> Retained<Self>
AVAsset only.Creates and initializes a download configuration object.
This method will throw an exception if AVURLAsset has been invalidated.
- Parameter asset: The asset to create the download configuration for.
- Parameter title: A human readable title for this asset, expected to be as suitable as possible for the user’s preferred languages. Will show up in the usage pane of the settings app.
Sourcepub unsafe fn artworkData(&self) -> Option<Retained<NSData>>
pub unsafe fn artworkData(&self) -> Option<Retained<NSData>>
NSData representing artwork data for this asset. Optional. May be displayed, for example, by the usage pane of the Settings app. Must work with +[UIImage imageWithData:].
Sourcepub unsafe fn setArtworkData(&self, artwork_data: Option<&NSData>)
pub unsafe fn setArtworkData(&self, artwork_data: Option<&NSData>)
Setter for artworkData.
This is copied when set.
Sourcepub unsafe fn primaryContentConfiguration(
&self,
) -> Retained<AVAssetDownloadContentConfiguration>
pub unsafe fn primaryContentConfiguration( &self, ) -> Retained<AVAssetDownloadContentConfiguration>
The primary content for the download.
Sourcepub unsafe fn auxiliaryContentConfigurations(
&self,
) -> Retained<NSArray<AVAssetDownloadContentConfiguration>>
pub unsafe fn auxiliaryContentConfigurations( &self, ) -> Retained<NSArray<AVAssetDownloadContentConfiguration>>
The auxiliary content for the download. Optional.
By default, auxiliaryContentConfigurations will have one or more default auxiliary content configurations. These content configurations can be augmented with additional content configurations or removed entirely if no auxiliary content is desired.
Sourcepub unsafe fn setAuxiliaryContentConfigurations(
&self,
auxiliary_content_configurations: &NSArray<AVAssetDownloadContentConfiguration>,
)
pub unsafe fn setAuxiliaryContentConfigurations( &self, auxiliary_content_configurations: &NSArray<AVAssetDownloadContentConfiguration>, )
Setter for auxiliaryContentConfigurations.
This is copied when set.
Sourcepub unsafe fn optimizesAuxiliaryContentConfigurations(&self) -> bool
pub unsafe fn optimizesAuxiliaryContentConfigurations(&self) -> bool
Optimizes auxiliary content selection depending on the primary to minimize total number of video renditions downloaded. True by default.
For example, if the primary content configuration represents stereo renditions and auxiliary content configuration represents multichannel audio renditions, auxiliary multichannel variant will be chosen so as to avoid downloading duplicate video renditions.
Sourcepub unsafe fn setOptimizesAuxiliaryContentConfigurations(
&self,
optimizes_auxiliary_content_configurations: bool,
)
pub unsafe fn setOptimizesAuxiliaryContentConfigurations( &self, optimizes_auxiliary_content_configurations: bool, )
Setter for optimizesAuxiliaryContentConfigurations.
Sourcepub unsafe fn downloadsInterstitialAssets(&self) -> bool
pub unsafe fn downloadsInterstitialAssets(&self) -> bool
Download interstitial assets as listed in the index file. False by default.
Ordinarily, interstitial assets are skipped when downloading content for later playback. Setting this property to true will cause interstitial assets to be downloaded as well. Playback of the downloaded content can then match the experience of online streaming playback as closely as possible.
Sourcepub unsafe fn setDownloadsInterstitialAssets(
&self,
downloads_interstitial_assets: bool,
)
pub unsafe fn setDownloadsInterstitialAssets( &self, downloads_interstitial_assets: bool, )
Setter for downloadsInterstitialAssets.
Sourcepub unsafe fn setInterstitialMediaSelectionCriteria_forMediaCharacteristic(
&self,
criteria: &NSArray<AVPlayerMediaSelectionCriteria>,
media_characteristic: &AVMediaCharacteristic,
)
Available on crate features AVMediaFormat and AVPlayerMediaSelectionCriteria only.
pub unsafe fn setInterstitialMediaSelectionCriteria_forMediaCharacteristic( &self, criteria: &NSArray<AVPlayerMediaSelectionCriteria>, media_characteristic: &AVMediaCharacteristic, )
AVMediaFormat and AVPlayerMediaSelectionCriteria only.Sets media selection on interstitials for this asset
Typically, interstitial assets have not been discovered when the main download is initiated. This method allows the user to specify AVMediaSelectionCriteria for all interstitials that are discovered. Each AVPlayerMediaSelectionCriteria in the array of criteria specfies a set of criteria for a variant to download.
- Parameter criteria: The array of selection criteria to set
- Parameter mediaCharacteristic: The AVMediaCharacteristic to which the criteria will be applied
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.
§Panics
May panic if the object is invalid (which may be the case for objects
returned from unavailable init/new methods).
§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 AsRef<NSObject> for AVAssetDownloadConfiguration
impl AsRef<NSObject> for AVAssetDownloadConfiguration
Source§impl ClassType for AVAssetDownloadConfiguration
impl ClassType for AVAssetDownloadConfiguration
Source§const NAME: &'static str = "AVAssetDownloadConfiguration"
const NAME: &'static str = "AVAssetDownloadConfiguration"
Source§type ThreadKind = <<AVAssetDownloadConfiguration as ClassType>::Super as ClassType>::ThreadKind
type ThreadKind = <<AVAssetDownloadConfiguration as ClassType>::Super as ClassType>::ThreadKind
Source§impl Debug for AVAssetDownloadConfiguration
impl Debug for AVAssetDownloadConfiguration
Source§impl Deref for AVAssetDownloadConfiguration
impl Deref for AVAssetDownloadConfiguration
Source§impl Hash for AVAssetDownloadConfiguration
impl Hash for AVAssetDownloadConfiguration
Source§impl NSObjectProtocol for AVAssetDownloadConfiguration
impl NSObjectProtocol for AVAssetDownloadConfiguration
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