iOS Developer Library

Developer

AVFoundation Framework Reference AVAssetResourceLoadingRequest Class Reference

Options
Deployment Target:

On This Page
Language:

AVAssetResourceLoadingRequest

An AVAssetResourceLoadingRequest object encapsulates information about a resource request issued from a resource loader object.

When an AVURLAsset object needs help loading a resource, it asks its AVAssetResourceLoader object to assist. The resource loader encapsulates the request information by creating an instance of this object, which it then hands to its delegate object for processing. The delegate uses the information in this object to perform the request and report on the success or failure of the operation.

Inheritance


Conforms To


Import Statement


Swift

import AVFoundation

Objective-C

@import AVFoundation;

Availability


Available in iOS 6.0 and later.
  • request request Property

    The URL request object for the resource. (read-only)

    Declaration

    Swift

    var request: NSURLRequest! { get }

    Objective-C

    @property(nonatomic, readonly) NSURLRequest *request

    Discussion

    Use the value in this property to identify the requested resource and to formulate an appropriate response object.

    Import Statement

    Objective-C

    @import AVFoundation;

    Swift

    import AVFoundation

    Availability

    Available in iOS 6.0 and later.

  • Obtains key request data for a specific combination of application and content.

    Declaration

    Swift

    func streamingContentKeyRequestDataForApp(_ appIdentifier: NSData!, contentIdentifier contentIdentifier: NSData!, options options: [NSObject : AnyObject]!, error outError: NSErrorPointer) -> NSData!

    Objective-C

    - (NSData *)streamingContentKeyRequestDataForApp:(NSData *)appIdentifier contentIdentifier:(NSData *)contentIdentifier options:(NSDictionary *)options error:(NSError **)outError

    Parameters

    appIdentifier

    An opaque content identifier for the application. The value of this identifier depends on the particular system used to provide the decryption key.

    contentIdentifier

    An opaque identifier for the content. The value of this identifier depends on the particular system used to provide the decryption key.

    options

    Additional information necessary to obtain the key, or nil if no additional information is required.

    outError

    On input, a pointer to an error object. If an error occurs while obtaining the streaming content key, the pointer is set to an appropriate error object on output.

    Return Value

    The key request data that must be transmitted to the key vendor to obtain the content key.

    Import Statement

    Objective-C

    @import AVFoundation;

    Swift

    import AVFoundation

    Availability

    Available in iOS 6.0 and later.

  • Information about the requested resource. (read-only)

    Declaration

    Swift

    var contentInformationRequest: AVAssetResourceLoadingContentInformationRequest! { get }

    Objective-C

    @property(nonatomic, readonly) AVAssetResourceLoadingContentInformationRequest *contentInformationRequest

    Discussion

    An instance of AVAssetResourceLoadingContentInformationRequest that you populate with information about the resource. The value of this property is nil if no such information is being requested.

    Import Statement

    Objective-C

    @import AVFoundation;

    Swift

    import AVFoundation

    Availability

    Available in iOS 7.0 and later.

  • The range of requested resource data. (read-only)

    Declaration

    Swift

    var dataRequest: AVAssetResourceLoadingDataRequest! { get }

    Objective-C

    @property(nonatomic, readonly) AVAssetResourceLoadingDataRequest *dataRequest

    Discussion

    An instance of AVAssetResourceLoadingDataRequest that indicates the range of resource data that's being requested. The value of this property is nil if no data is being requested.

    Import Statement

    Objective-C

    @import AVFoundation;

    Swift

    import AVFoundation

    Availability

    Available in iOS 7.0 and later.

  • redirect redirect Property

    An URL request instance if the loading request was redirected.

    Declaration

    Swift

    @NSCopying var redirect: NSURLRequest!

    Objective-C

    @property(nonatomic, copy) NSURLRequest *redirect

    Discussion

    Set this property to an instance of NSURLRequest indicating a redirection of the loading request to another URL.

    If no redirection is needed, the value of this property must be nil, which is the default.

    Import Statement

    Objective-C

    @import AVFoundation;

    Swift

    import AVFoundation

    Availability

    Available in iOS 7.0 and later.

  • response response Property

    The URL response for the loading request.

    Declaration

    Swift

    @NSCopying var response: NSURLResponse!

    Objective-C

    @property(nonatomic, copy) NSURLResponse *response

    Discussion

    The value of this property to an instance of NSURLResponse, indicating a response to the loading request. If no response is needed, the value of this property is nil.

    Import Statement

    Objective-C

    @import AVFoundation;

    Swift

    import AVFoundation

    Availability

    Available in iOS 7.0 and later.

  • Causes the receiver to finish loading a resource for which a resource loader’s delegate took responsibility .

    Deprecation Statement

    This method is deprecated. Use the following methods and properties instead: the response property to provide the response object, the redirect property when redirecting a request, invoking the dataRequest instance‘srespondWithData: method to provide data, and the finishLoading method to indicate that loading is finished.

    Declaration

    Objective-C

    - (void)finishLoadingWithResponse:(NSURLResponse *)response data:(NSData *)data redirect:(NSURLRequest *)redirect

    Parameters

    response

    The response object for the requested resource. Use the request object in the receiver’s request property to get information about the requested resource.

    data

    The data of the resource. If no data is available, specify nil.

    redirect

    When redirecting a resource request, use this parameter to specify the corresponding NSURLRequest object. If you are handling the request and not redirecting it, specify nil.

    Discussion

    When a resource loader’s delegate takes responsibility for loading a resource, it calls this method to indicate that the resource was loaded successfully. This method marks the loading request as finished and returns the provided data back to the resource loader object for processing.

    Import Statement

    Objective-C

    @import AVFoundation;

    Availability

    Available in iOS 6.0 and later.

    Deprecated in iOS 7.0.

  • Causes the receiver to treat the processing of the request as complete.

    Declaration

    Swift

    func finishLoading()

    Objective-C

    - (void)finishLoading

    Discussion

    If a dataRequest is present and the resource does not contain the full extent of the data that has been requested according to the values of the requestedOffset and requestedLength properties of the request, invoke finishLoading after providing as much of the requested data as the resource contains.

    Import Statement

    Objective-C

    @import AVFoundation;

    Swift

    import AVFoundation

    Availability

    Available in iOS 7.0 and later.

  • cancelled cancelled Property

    A Boolean value that indicates whether the request has been cancelled. (read-only)

    Declaration

    Swift

    var cancelled: Bool { get }

    Objective-C

    @property(nonatomic, readonly, getter=isCancelled) BOOL cancelled

    Discussion

    YEStrue when the resource loader cancels the loading of a request, just prior to sending the message resourceLoader:didCancelLoadingRequest: to the delegate.

    Import Statement

    Objective-C

    @import AVFoundation;

    Swift

    import AVFoundation

    Availability

    Available in iOS 7.0 and later.

  • Causes the receiver to handle the failure to load a resource for which a resource loader’s delegate took responsibility.

    Declaration

    Swift

    func finishLoadingWithError(_ error: NSError!)

    Objective-C

    - (void)finishLoadingWithError:(NSError *)error

    Parameters

    error

    An error object indicating the reason for the failure.

    Discussion

    When a resource loader’s delegate takes responsibility for loading a resource, it calls this method when a failure occurred when loading the resource. This method marks the loading request as finished and notifies the resource loader object that the resource could not be loaded.

    Import Statement

    Objective-C

    @import AVFoundation;

    Swift

    import AVFoundation

    Availability

    Available in iOS 6.0 and later.

  • finished finished Property

    A Boolean value that indicates whether loading of the resource has finished. (read-only)

    Declaration

    Swift

    var finished: Bool { get }

    Objective-C

    @property(nonatomic, readonly, getter=isFinished) BOOL finished

    Discussion

    The value of this property is NOfalse initially. The value changes to YEStrue when the delegate object handling the request calls the finishLoadingWithResponse:data:redirect: or finishLoadingWithError: method.

    Import Statement

    Objective-C

    @import AVFoundation;

    Swift

    import AVFoundation

    Availability

    Available in iOS 6.0 and later.