I'm recording video using RPScreenRecorder.shared().startRecording
. However, I want to let the user share the video from within the app. This is the code that stops recording and previews the video in a view controller and gives the user the option to save to photos or cancel.
I cannot figure out how to grab the video from the view controllers view. When I dug into the subviews: preview.view.subviews.first!.subviews.first!
There's a view of type: UIRemoteView
with no subviews.
Is it possible to grab the video? Or better yet, is there a way to show a UIActivityViewController
to allow the user to share the video?
for macOS I could do preview.mode = .share
, but for iOS this is not available.
RPScreenRecorder.shared().stopRecording { preview, error in
guard let preview = preview else { return }
self.present(preview, animated: true, completion: nil)
}
There is a share button but it is not visible, if view controller is not presented fullscreen, I think this is a bug related to PRPreviewViewController
.
You can change modalTransitionStyle and see share button.
RPScreenRecorder.shared().stopRecording { preview, error in
guard let preview = preview else { return }
preview.modalPresentationStyle = .overFullScreen
self.present(preview, animated: true, completion: nil)
}