Подтвердить что ты не робот

Позволяет ли replaykit записывать экран, а затем транслировать экран?

У меня возникла проблема, когда после трансляции экрана в реальном времени я пытаюсь записать экран, но он не работает. То же самое происходит, когда я записываю свой экран, а затем я пытаюсь транслировать экран вживую. Я не пытаюсь сделать их вместе. Это происходит после того, как все сделано, и я пытаюсь использовать другой. Дайте мне знать, если вам нужно увидеть код или получить дополнительную информацию. Im в Swift 3 и используя новую структуру набора реплик. Спасибо!

РЕДАКТИРОВАТЬ: ЭТО ИСПОЛЬЗОВАНИЕ КОДА

//LIVE STREAM REPLAYKIT=====================================================================
func broadcastActivityViewController(_ broadcastAVC: RPBroadcastActivityViewController, didFinishWith broadcastController: RPBroadcastController?, error: Error?) {
    print("=====hello delegate \(broadcastController?.broadcastURL) (error)")

    self.broadcastController = broadcastController
    self.broadcastController?.delegate = self

    broadcastAVC.dismiss(animated: true) {
        self.broadcastController?.startBroadcast(handler: { error in

            print("start broadcast \(error)")
            print("\(broadcastController?.broadcastExtensionBundleID)")
            print("==url=\(broadcastController?.broadcastURL)")
            print("==serviceInfo=\(broadcastController?.serviceInfo)")

    //This is called when the broadcast is live

    })
  }
}


func broadcastController(_ broadcastController: RPBroadcastController, didFinishWithError error: Error?) {
    print("broadcastController====delegate")

    let alert = UIAlertController(title: "Alert", message: "There was an error broadcasting your screen. Please try again", preferredStyle: UIAlertControllerStyle.alert)

    // show the alert
    self.view!.window?.rootViewController!.present(alert, animated: true, completion: nil)

    alert.addAction(UIAlertAction(title: "Okay", style: UIAlertActionStyle.destructive, handler: { action in

        // add action
   }))
}



 func broadcastController(_ broadcastController: RPBroadcastController, didUpdateServiceInfo serviceInfo: [String : NSCoding & NSObjectProtocol]) {
    print("broadcastController====didUpdateServiceInfo")
  }

  //LIVE STREAM REPLAYKIT=========================================================


 //RECORD SCREEN REPLAYKIT-------------------------------------------------------------------
func startRecoding() {
    let recorder = RPScreenRecorder.shared()
    if recorder.isAvailable {
        recorder.startRecording(handler: { (error) in


   if error == nil { // Recording has started


    } else {
                // Handle error
                print("Dont Allow Recording")

    }
 })

    } else {
        print("Did not record screen")

        //if iphone or ipad doesnt support replaykit

        // create the alert
        let alert = UIAlertController(title: "Alert", message: "Please make sure your device supports ReplayKit!", preferredStyle: UIAlertControllerStyle.alert)


        // show the alert
        self.view!.window?.rootViewController!.present(alert, animated: true, completion: nil)

        alert.addAction(UIAlertAction(title: "Try Again!", style: UIAlertActionStyle.destructive, handler: { action in
            // add action

    }))
  }
}


func stopRecording() {

    let sharedRecorder = RPScreenRecorder.shared()
    sharedRecorder.stopRecording(handler: { (previewViewController: RPPreviewViewController?, error) in

 if previewViewController != nil {
            print("stopped recording")

            previewViewController!.previewControllerDelegate = self

            let alertController = UIAlertController(title: "Recording", message: "Tap view to watch, edit, share, or save your screen recording!", preferredStyle: .alert)

            let viewAction = UIAlertAction(title: "View", style: .default, handler: { (action: UIAlertAction) -> Void in

                self.view?.window?.rootViewController?.present(previewViewController!, animated: true, completion: nil)

 })

            alertController.addAction(viewAction)
            self.previewViewController = previewViewController!
            self.previewViewController.modalPresentationStyle = UIModalPresentationStyle.fullScreen
            self.view?.window?.rootViewController!.present(alertController, animated: true, completion: nil)
 }


 else {
            print("recording stopped working")

            //create the alert================================

            let alert = UIAlertController(title: "Alert", message: "Sorry, there was an error recording your screen. Please Try Again!", preferredStyle: UIAlertControllerStyle.alert)

            // show the alert
            self.view!.window?.rootViewController!.present(alert, animated: true, completion: nil)

            alert.addAction(UIAlertAction(title: "Try Again!", style: UIAlertActionStyle.destructive, handler: { action in
                // add action

          }))
       }
   })
 }


func previewControllerDidFinish(_ previewViewController: RPPreviewViewController) {

print("cancel and save button pressed")

previewViewController.dismiss(animated: true, completion: nil)
//dismiss preview view controller when save or cancel button pressed

}
4b9b3361

Ответ 1

Я считаю, что это ошибка в ReplayKit, я не уверен, что она была решена с 10.1 или нет, но стоит попробовать 10.1 beta, чтобы узнать, разрешает ли она вашу проблему.