I found this requiresFlushToResumeDecoding will become true after iPhone lock for a while, before PiP turns black screen. Then as the doc says, flush the bufferLayer will resume it.
So here is the solution for me:
if bufferLayer.requiresFlushToResumeDecoding {
bufferLayer.flush()
}
if bufferLayer.isReadyForMoreMediaData {
bufferLayer.enqueue(sampleBuffer)
}
Topic:
UI Frameworks
SubTopic:
UIKit
Tags: