如果用户现在尝试屏幕录像机,我有一个检测代码我想停止录制,这意味着左侧的红色部分已停止
这是我现在检测的代码如何自动停止录制或在 isCaptured == true 中关闭录制我找不到任何关于如何停止的代码
override func observeValue(forKeyPath keyPath: String?, of object: Any?, change: [NSKeyValueChangeKey: Any]?, context: UnsafeMutableRawPointer?) {
if (keyPath == "captured") {
let isCaptured = UIScreen.main.isCaptured
if (isCaptured == true) {
///How to stop screen recording after 5 sec
}
}
这是我创建屏幕录像机的代码现在我想用一个按钮停止它
let broadcastPickerView = RPSystemBroadcastPickerView(frame: CGRect(x:0, y: 0, width: btnRS.frame.width, height: btnRS.frame.height))
broadcastPickerView.translatesAutoresizingMaskIntoConstraints = false
if let button = broadcastPickerView.subviews.first as? UIButton {
button.imageView?.tintColor = UIColor.white
}
btnRS.addSubview(broadcastPickerView)
broadcastPickerView.tintColor = .yellow
broadcastPickerView.backgroundColor = .clear
broadcastPickerView.showsMicrophoneButton = true
btnRS.titleEdgeInsets = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0)
}