【发布时间】:2019-01-04 04:52:10
【问题描述】:
我正在使用 ReplayKit api 捕获视频/音频样本。下面是截屏的sn-p
recorder.startCapture(handler: {
(cmSampleBuffer, rpSampleBufferType, error) in
AssetWriter.shared.write(buffer: cmSampleBuffer, bufferType: rpSampleBufferType)
}, completionHandler: {
(error) in
if let error = error {
self.isCapturing = false
NSLog("Error in capturing screens: \(error.localizedDescription)")
} else {
self.isCapturing = true
NSLog("Capturing started successfully.")
}
self.updateViewButtons()
})
并使用 AVAssetWriter 将这些 cmSampleBuffers 转换为电影文件,但我想限制电影文件的大小,如果超过 1 分钟,则仅捕获最后 1 分钟。
【问题讨论】:
-
你找到解决办法了吗。