AVAssetResourceLoaderDelegate

Trait AVAssetResourceLoaderDelegate 

Source
pub unsafe trait AVAssetResourceLoaderDelegate: NSObjectProtocol {
    // Provided methods
    unsafe fn resourceLoader_shouldWaitForLoadingOfRequestedResource(
        &self,
        resource_loader: &AVAssetResourceLoader,
        loading_request: &AVAssetResourceLoadingRequest,
    ) -> bool
       where Self: Sized + Message { ... }
    unsafe fn resourceLoader_shouldWaitForRenewalOfRequestedResource(
        &self,
        resource_loader: &AVAssetResourceLoader,
        renewal_request: &AVAssetResourceRenewalRequest,
    ) -> bool
       where Self: Sized + Message { ... }
    unsafe fn resourceLoader_didCancelLoadingRequest(
        &self,
        resource_loader: &AVAssetResourceLoader,
        loading_request: &AVAssetResourceLoadingRequest,
    )
       where Self: Sized + Message { ... }
    unsafe fn resourceLoader_shouldWaitForResponseToAuthenticationChallenge(
        &self,
        resource_loader: &AVAssetResourceLoader,
        authentication_challenge: &NSURLAuthenticationChallenge,
    ) -> bool
       where Self: Sized + Message { ... }
    unsafe fn resourceLoader_didCancelAuthenticationChallenge(
        &self,
        resource_loader: &AVAssetResourceLoader,
        authentication_challenge: &NSURLAuthenticationChallenge,
    )
       where Self: Sized + Message { ... }
}
Available on crate feature AVAssetResourceLoader only.
Expand description

The AVAssetResourceLoaderDelegate protocol defines methods that allow your code to handle resource loading requests coming from an AVURLAsset.

See also Apple’s documentation

Provided Methods§

Source

unsafe fn resourceLoader_shouldWaitForLoadingOfRequestedResource( &self, resource_loader: &AVAssetResourceLoader, loading_request: &AVAssetResourceLoadingRequest, ) -> bool
where Self: Sized + Message,

Invoked when assistance is required of the application to load a resource.

Parameter resourceLoader: The instance of AVAssetResourceLoader for which the loading request is being made.

Parameter loadingRequest: An instance of AVAssetResourceLoadingRequest that provides information about the requested resource.

Returns: YES if the delegate can load the resource indicated by the AVAssetResourceLoadingRequest; otherwise NO.

Delegates receive this message when assistance is required of the application to load a resource. For example, this method is invoked to load decryption keys that have been specified using custom URL schemes. If the result is YES, the resource loader expects invocation, either subsequently or immediately, of either -[AVAssetResourceLoadingRequest finishLoading] or -[AVAssetResourceLoadingRequest finishLoadingWithError:]. If you intend to finish loading the resource after your handling of this message returns, you must retain the instance of AVAssetResourceLoadingRequest until after loading is finished. If the result is NO, the resource loader treats the loading of the resource as having failed. Note that if the delegate’s implementation of -resourceLoader:shouldWaitForLoadingOfRequestedResource: returns YES without finishing the loading request immediately, it may be invoked again with another loading request before the prior request is finished; therefore in such cases the delegate should be prepared to manage multiple loading requests.

If an AVURLAsset is added to an AVContentKeySession object and a delegate is set on its AVAssetResourceLoader, that delegate’s resourceLoader:shouldWaitForLoadingOfRequestedResource: method must specify which custom URL requests should be handled as content keys. This is done by returning YES and passing either AVStreamingKeyDeliveryPersistentContentKeyType or AVStreamingKeyDeliveryContentKeyType into -[AVAssetResourceLoadingContentInformationRequest setContentType:] and then calling -[AVAssetResourceLoadingRequest finishLoading].

Source

unsafe fn resourceLoader_shouldWaitForRenewalOfRequestedResource( &self, resource_loader: &AVAssetResourceLoader, renewal_request: &AVAssetResourceRenewalRequest, ) -> bool
where Self: Sized + Message,

Invoked when assistance is required of the application to renew a resource.

Parameter resourceLoader: The instance of AVAssetResourceLoader for which the loading request is being made.

Parameter renewalRequest: An instance of AVAssetResourceRenewalRequest that provides information about the requested resource.

Returns: YES if the delegate can renew the resource indicated by the AVAssetResourceLoadingRequest; otherwise NO.

Delegates receive this message when assistance is required of the application to renew a resource previously loaded by resourceLoader:shouldWaitForLoadingOfRequestedResource:. For example, this method is invoked to renew decryption keys that require renewal, as indicated in a response to a prior invocation of resourceLoader:shouldWaitForLoadingOfRequestedResource:. If the result is YES, the resource loader expects invocation, either subsequently or immediately, of either -[AVAssetResourceRenewalRequest finishLoading] or -[AVAssetResourceRenewalRequest finishLoadingWithError:]. If you intend to finish loading the resource after your handling of this message returns, you must retain the instance of AVAssetResourceRenewalRequest until after loading is finished. If the result is NO, the resource loader treats the loading of the resource as having failed. Note that if the delegate’s implementation of -resourceLoader:shouldWaitForRenewalOfRequestedResource: returns YES without finishing the loading request immediately, it may be invoked again with another loading request before the prior request is finished; therefore in such cases the delegate should be prepared to manage multiple loading requests.

If an AVURLAsset is added to an AVContentKeySession object and a delegate is set on its AVAssetResourceLoader, that delegate’s resourceLoader:shouldWaitForRenewalOfRequestedResource:renewalRequest method must specify which custom URL requests should be handled as content keys. This is done by returning YES and passing either AVStreamingKeyDeliveryPersistentContentKeyType or AVStreamingKeyDeliveryContentKeyType into -[AVAssetResourceLoadingContentInformationRequest setContentType:] and then calling -[AVAssetResourceLoadingRequest finishLoading].

Source

unsafe fn resourceLoader_didCancelLoadingRequest( &self, resource_loader: &AVAssetResourceLoader, loading_request: &AVAssetResourceLoadingRequest, )
where Self: Sized + Message,

Informs the delegate that a prior loading request has been cancelled.

Parameter loadingRequest: The loading request that has been cancelled.

Previously issued loading requests can be cancelled when data from the resource is no longer required or when a loading request is superseded by new requests for data from the same resource. For example, if to complete a seek operation it becomes necessary to load a range of bytes that’s different from a range previously requested, the prior request may be cancelled while the delegate is still handling it.

Source

unsafe fn resourceLoader_shouldWaitForResponseToAuthenticationChallenge( &self, resource_loader: &AVAssetResourceLoader, authentication_challenge: &NSURLAuthenticationChallenge, ) -> bool
where Self: Sized + Message,

Invoked when assistance is required of the application to respond to an authentication challenge.

Parameter resourceLoader: The instance of AVAssetResourceLoader asking for help with an authentication challenge.

Parameter authenticationChallenge: An instance of NSURLAuthenticationChallenge.

Delegates receive this message when assistance is required of the application to respond to an authentication challenge. If the result is YES, the resource loader expects you to send an appropriate response, either subsequently or immediately, to the NSURLAuthenticationChallenge’s sender, i.e. [authenticationChallenge sender], via use of one of the messages defined in the NSURLAuthenticationChallengeSender protocol (see NSAuthenticationChallenge.h). If you intend to respond to the authentication challenge after your handling of -resourceLoader:shouldWaitForResponseToAuthenticationChallenge: returns, you must retain the instance of NSURLAuthenticationChallenge until after your response has been made.

Source

unsafe fn resourceLoader_didCancelAuthenticationChallenge( &self, resource_loader: &AVAssetResourceLoader, authentication_challenge: &NSURLAuthenticationChallenge, )
where Self: Sized + Message,

Informs the delegate that a prior authentication challenge has been cancelled.

Parameter authenticationChallenge: The authentication challenge that has been cancelled.

Trait Implementations§

Source§

impl ProtocolType for dyn AVAssetResourceLoaderDelegate

Source§

const NAME: &'static str = "AVAssetResourceLoaderDelegate"

The name of the Objective-C protocol that this type represents. Read more
Source§

fn protocol() -> Option<&'static AnyProtocol>

Get a reference to the Objective-C protocol object that this type represents. Read more
Source§

impl<T> ImplementedBy<T> for dyn AVAssetResourceLoaderDelegate

Implementations on Foreign Types§

Source§

impl<T> AVAssetResourceLoaderDelegate for ProtocolObject<T>

Implementors§