2

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
    }
MidDev
  • 182
  • 1
  • 15
  • Hello, Thanks for asking this question. I am searching a solution for the same question. Have you found any hack? – indrajit May 01 '19 at 12:09
  • @indrajit hello i don't find any why right now are you finding any solution – MidDev May 03 '19 at 11:55
  • Hello @MidDev, I am using twilio API to share the screen. So just disconnected the room. But one more solution worked for me is crash the extension :D, Wherever you want to stop just write one line of code which crashes the app/extension e.g. device by zero or accessing nil value. #pardon my poor english – indrajit May 07 '19 at 11:39
  • @indrajit How did you call the `BroadcastExtension` method in app to crash the extension? – TheTiger Jun 04 '20 at 10:02

2 Answers2

0

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

Ken Laam
  • 9
  • 1
  • 3
-1

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.

something Like this will display to user after stream stops