如果用户现在要尝试截屏录像机,我有一个代码可以检测到,我想停止录像,这意味着左侧的红色部分已停止
这是我的代码,现在可以检测如何自动停止记录或关闭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)
}