使用RPScreenRecorder开始捕获保存屏幕录像 [英] Saving a screen recording with RPScreenRecorder start capture
本文介绍了使用RPScreenRecorder开始捕获保存屏幕录像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试使用RPScreenRecorder.shared().startCapture将屏幕录像保存到firebase.我知道如何从AVCapture中保存视频,但无法弄清楚如何处理CMSampleBuffer来创建要保存到Firebase的文件.请帮助我在任何地方都找不到此文档,这是方法调用:
I am attempting to use RPScreenRecorder.shared().startCapture to save a screen recording to firebase. I know how to save videos from AVCapture but cant figure out how to process The CMSampleBuffer to create a file to save to firebase. Please help I cant find documentation on this anywhere yet, here is the method call:
let recorder = RPScreenRecorder.shared()
if #available(iOS 11.0, *) {
recorder.startCapture(handler: { (videoBuffer, bufferType, error) in
print(videoBuffer)
print(bufferType)
}, completionHandler: { (error) in
})
} else {
// Fallback on earlier versions
}
即使指向正确的方向也会有所帮助,我迷失了如何将示例缓冲区保存为可作为视频播放的文件
Even being pointed in the right direction would be helpful, I am lost at how to save THE sample BUFFER as a file that can be played as a video
推荐答案
RPScreenRecorder.shared().startCapture(handler: { (sample, bufferType, error) in
if CMSampleBufferDataIsReady(sample)
{
self.showOverlayWindow()
if self.assetWriter.status == AVAssetWriterStatus.unknown
{
self.assetWriter.startWriting()
self.assetWriter.startSession(atSourceTime: CMSampleBufferGetPresentationTimeStamp(sample))
}
if self.assetWriter.status == AVAssetWriterStatus.failed {
print("Error occured, status = \(self.assetWriter.status.rawValue), \(self.assetWriter.error!.localizedDescription) \(String(describing: self.assetWriter.error))")
return
}
if (bufferType == .video)
{
if self.videoInput.isReadyForMoreMediaData
{
self.videoInput.append(sample)
}
}
}
}) { (error) in
debugPrint(error)
}
可以在此处
这篇关于使用RPScreenRecorder开始捕获保存屏幕录像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文