3

これが開始関数と停止関数です。

@IBAction func startRecordingAction(sender: AnyObject) {
            activityView.hidden = false

        // start recording
        recorder.startRecordingWithMicrophoneEnabled(true) { [unowned self] (error) in
            dispatch_async(dispatch_get_main_queue()) {
                [unowned self] in
                self.activityView.hidden = true
            }

            if let error = error {
                print("Failed start recording: \(error.localizedDescription)")
                return
            }

            print("Start recording")
            self.buttonEnabledControl(true)


        }
    }

    @IBAction func stopRecordingAction(sender: AnyObject) {
        activityView.hidden = false

        //end recording
        recorder.stopRecordingWithHandler({ [unowned self] (previewViewController, error) in
            dispatch_async(dispatch_get_main_queue()) {
                self.activityView.hidden = true
            }

            self.buttonEnabledControl(false)

            if let error = error {
                print("Failed stop recording: \(error.localizedDescription)")
                return
            }

            print("Stop recording")
            previewViewController?.previewControllerDelegate = self



            dispatch_async(dispatch_get_main_queue()) { [unowned self] in
                // show preview vindow
                self.presentViewController(previewViewController!, animated: true, completion: nil)
            }
        })
    }
func screenRecorderDidChangeAvailability(screenRecorder: RPScreenRecorder) {
        let availability = screenRecorder.available
        print("Availability: \(availability)\n");
    }

    // MARK: - RPPreviewViewControllerDelegate
    // called when preview is finished
    func previewControllerDidFinish(previewController: RPPreviewViewController) {
        print("Preview finish");

        dispatch_async(dispatch_get_main_queue()) { 
            [unowned previewController] in
            // close preview window
            previewController.dismissViewControllerAnimated(true, completion: nil)
        }
    }

ReplayKit画面の一部だけを録画し、標準のアラート メッセージではなくカスタム アラートを表示したい。サードパーティのポッドを使用できますが、問題ありません。.なしで、別の方法でアドバイスできるかもしれませんReplayKit

4

1 に答える 1