Class

AVAssetResourceLoadingDataRequest

An object used to request data from a resource referenced by an asset resource loading request.

Declaration

class AVAssetResourceLoadingDataRequest : NSObject

Overview

The AVAssetResourceLoaderDelegate uses the AVAssetResourceLoadingDataRequest class to do the actual data reading, and its methods will be invoked, as necessary, to acquire data for the AVAssetResourceLoadingRequest instance.

When the resource loading delegate, which implements the AVAssetResourceLoaderDelegate protocol, receives an instance of AVAssetResourceLoadingRequest as the second parameter of the delegate’s resourceLoader(_:shouldWaitForLoadingOfRequestedResource:) method, it has the option of accepting responsibility for loading the referenced resource. If it accepts that responsibility, by returning true, it must check whether the dataRequest property of the AVAssetResourceLoadingRequest instance is not nil. If it is not nil, the resource loading delegate is informed of the range of bytes within the resource that are required by the underlying media system. In response, the data is provided by one or more invocations of respond(with:) as required to provide the requested data. The data can be provided in increments determined by the resource loading delegate according to convenience or efficiency.

When the AVAssetResourceLoadingRequest method finishLoading() is invoked, the data request is considered fully satisfied. If the entire range of bytes requested has not yet been provided, the underlying media system assumes that the resource's length is limited to the provided content.

Topics

Providing Data to a Request

func respond(with: Data)

Provides data to the loading request.

var requestedLength: Int

The length, in bytes, of the data requested.

var requestedOffset: Int64

The position within the resource of the first byte requested.

var currentOffset: Int64

The position within the resource of the next byte.

var requestsAllDataToEndOfResource: Bool

A Boolean value that indicates the entire remaining length of the resource from the offest to the end of the resource is being requested.

Relationships

Inherits From

Conforms To

See Also

Asset Retrieval

class AVURLAsset

A concrete subclass of AVAsset that's used to initialize an asset from a local or remote URL.

class AVAssetDownloadURLSession

A URL session used to support the creation and execution of asset download tasks.

class AVAssetResourceLoader

An object that mediates resource requests from a URL asset.

class AVAssetResourceLoadingRequest

An object that encapsulates information about a resource request issued by a resource loader object.

var response: URLResponse?

The URL response for the loading request.

class AVAssetResourceRenewalRequest

An object that encapsulates information about a resource request issued by a resource loader to renew a previously issued request.

class AVAssetResourceLoadingContentInformationRequest

A query used to get essential information about a resource referenced by an asset resource loading request.

class AVAssetDownloadStorageManager

A manager of policies used to automatically purge downloaded assets.

class AVAssetDownloadStorageManagementPolicy

A set of properties that defines a policy to automatically purge downloaded assets.

class AVMutableAssetDownloadStorageManagementPolicy

A mutable set of properties that defines a policy to automatically purge downloaded assets.