How to stop Screen Recording in App Swift 4

1.3k views Asked by At

I have one code for detected if user try to screen recorder now I want to stop recording that's mean the red part in left side is stoped

here is my code for detecting now how can I stop recording automatically or dismiss recording in isCaptured == true I can't find any code for how to stop

    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
                }
}

here is my code for creating the Screen Recorder now I want to stop this with one button

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)


}
0

There are 0 answers