我ReplayKit
用于获取视频流。callback 不断调用但rpSampleType
返回其他内容。我只想要视频缓冲区。
这是我的代码
RPScreenRecorder.shared().startCapture(handler: { (cmSampleBuffer, rpSampleType, error) in
if CMSampleBufferDataIsReady(cmSampleBuffer){
switch rpSampleType {
case RPSampleBufferType.video:
// create the CVPixelBuffer
let pixelBuffer = CMSampleBufferGetImageBuffer(cmSampleBuffer)!
let rtcpixelBuffer = RTCCVPixelBuffer(pixelBuffer: pixelBuffer)
default:
print("sample has no matching type")
}
}
}) { (error) in
print(error?.localizedDescription)
}