简体   繁体   中英

Swift Broadcast Replaykit Stop Recording

I have this code for running the BroadCast now I need one Button in App to stop broadcast without going to Notification Centre is that possible.

override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view, typically from a nib.

        UIScreen.main.addObserver(self, forKeyPath: "captured", options: .new, context: nil)

    }


func addRPkitVw() {



        let broadcastPickerView = RPSystemBroadcastPickerView(frame: CGRect(x: (holderVw.frame.width / 2) - 19, y: 0, width: 38, height: 38))
        holderVw.addSubview(broadcastPickerView)
        broadcastPickerView.backgroundColor = .clear
        broadcastPickerView.showsMicrophoneButton = true
    }

I'm facing same issue, but have you tried with finishBroadcastWithError in RPBroadcastSampleHandler . It's temporary solution, cus there is error popup

You have to pass a message to our Extension Whenever you need to stop the recording. Now in your Upload Broadcast Extension when you get the message just call the finishBroadcastWithError function and pass your own error type. Example:- Recording successfully stoped etc.

像这样的东西会在流停止后显示给用户

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM