Instance Method

requestMediaDataWhenReady(on:using:)

Instructs the target to invoke a client-supplied block repeatedly, at its convenience, in order to gather sample buffers for display.

Declaration

func requestMediaDataWhenReady(on queue: DispatchQueue, using block: @escaping () -> Void)

Parameters

queue

The dispatch queue.

block

The block that provides media data.

Discussion

The block is expected to call the enqueue(_:) in order to provide media data for decompression (if necessary) and rendering while the isReadyForMoreMediaData property remains true, or until it can provide no additional media. When the layer has decoded enough media data that it is ready for additional media data, it will invoke the block again.

By allowing the display layer to determine when to invoke the block, the implementation of incremental I/O operations is simplified when supplying synchronized media data during rendering.

If this function is called multiple times, only the last call is effective.

You invoke the stopRequestingMediaData() method to cancel this request.

Each call to requestMediaDataWhenReadyOnQueue:usingBlock: must be balanced with a corresponding call to stopRequestingMediaData().

Releasing the receiver instance without a call to stopRequestingMediaData() will result in undefined behavior.

See Also

Initiating Media Data Requests

var isReadyForMoreMediaData: Bool

A Boolean value that indicates the readiness of the layer to accept more sample buffers.

func stopRequestingMediaData()

Cancels any current media data request.