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: dispatch_queue_t, using block: @escaping @Sendable () -> Void)Parameters
- queue:
The dispatch queue.
- block:
The block that provides media data.
Discussion
Apple discourages the use of this symbol in iOS 17, tvOS 17, and macOS 14 and later. Use requestMediaDataWhenReady(on:using:) on the sampleBufferRenderer instead.
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.