iOS Developer Library

Developer

AVFoundation Framework Reference AVAssetResourceLoader Class Reference

Options
Deployment Target:

On This Page
Language:

AVAssetResourceLoader

Inherits From


Conforms To


Import Statement


Swift

import AVFoundation

Objective-C

@import AVFoundation;

Availability


Available in iOS 6.0 and later

An AVAssetResourceLoader object mediates resource requests from an AVURLAsset object with a delegate object that you provide. When a request arrives, the resource loader asks your delegate if it is able to handle the request and reports the results back to the asset.

You do not create resource loader objects yourself. Instead, you retrieve a resource loader from the resourceLoader property of an AVURLAsset object and use it to assign your custom delegate object.

The delegate you associate with this object must adopt the AVAssetResourceLoaderDelegate protocol. For more information, see AVAssetResourceLoaderDelegate Protocol Reference.

The AVARLDelegateDemo demonstrates using this class in a streaming environment.

  • Sets the delegate and dispatch queue to use with the resource loader.

    Declaration

    Swift

    func setDelegate(_ delegate: AVAssetResourceLoaderDelegate!, queue delegateQueue: dispatch_queue_t!)

    Objective-C

    - (void)setDelegate:(id<AVAssetResourceLoaderDelegate>)delegate queue:(dispatch_queue_t)delegateQueue

    Parameters

    delegate

    The delegate object to query when handling resource requests. You may specify nil if you want to clear the delegate object. The resource loader does not store a strong reference to the delegate object.

    delegateQueue

    The dispatch queue on which to execute resource requests. If the delegate parameter is not nil, this parameter must also not be nil and must contain a valid dispatch queue. However, if delegate is nil, this parameter may also be nil.

    The resource loader maintains a strong reference to the dispatch queue you specify.

    Discussion

    You use this method to specify the object to use when handling resource requests and the dispatch queue on which to process those requests. Resource requests are processed synchronously on the dispatch queue you provide.

    Import Statement

    Objective-C

    @import AVFoundation;

    Swift

    import AVFoundation

    Availability

    Available in iOS 6.0 and later

  • delegate delegate Property

    The delegate object to use when handling resource requests. (read-only)

    Declaration

    Swift

    var delegate: AVAssetResourceLoaderDelegate! { get }

    Objective-C

    @property(nonatomic, readonly) id< AVAssetResourceLoaderDelegate > delegate

    Discussion

    The delegate object is responsible for indicating whether or not it is able to handle a resource request. And for those requests it does handle, the delegate object must initiate the loading of the requested resource.

    Import Statement

    Objective-C

    @import AVFoundation;

    Swift

    import AVFoundation

    Availability

    Available in iOS 6.0 and later

  • The dispatch queue to use when handling resource requests. (read-only)

    Declaration

    Swift

    var delegateQueue: dispatch_queue_t! { get }

    Objective-C

    @property(nonatomic, readonly) dispatch_queue_t delegateQueue

    Discussion

    Resource requests are processed synchronously on the specified dispatch queue.

    Import Statement

    Objective-C

    @import AVFoundation;

    Swift

    import AVFoundation

    Availability

    Available in iOS 6.0 and later