我正在尝试使用Replaykit实现ScreenRecording。它目前可以录制应用程序屏幕,但是当我将它放在后台进行设备屏幕录制时,则不会调用RPScreenRecorder.startCapture
回调。
let recorder = RPScreenRecorder.shared()
recorder.delegate = self
recorder.startCapture(handler: { (buffer, bufferType, err) in
self.counter = self.counter.advanced(by: 1)
print(self.counter)
// self.assetWriter.write(buffer: buffer, bufferType: bufferType)
}, completionHandler: {
if let error = $0 {
print(error)
}
})
// stop recording
recorder.stopCapture {
if let err = $0 {
print(err)
}
// self.assetWriter.finishWriting()
}
我们需要允许任何权限进行后台访问吗?