Posts

Post not yet marked as solved
1 Replies
129 Views
In the app there is a webview which is a web game with sound and video @IBOutlet var webView: WKWebView! webView.navigationDelegate = self let url=URL(string: "https://www.crazygames.com/game/tap-tap-shots") webView.load(URLRequest(url: url!)) I use RPScreenRecorder import ReplayKit import UIKit class ViewController: UIViewController, RPPreviewViewControllerDelegate { override func viewDidLoad() { super.viewDidLoad() navigationItem.rightBarButtonItem = UIBarButtonItem(title: "Start", style: .plain, target: self, action: #selector(startRecording)) } @objc func startRecording() { let recorder = RPScreenRecorder.shared() recorder.startRecording{ [unowned self] (error) in if let unwrappedError = error { print(unwrappedError.localizedDescription) } else { self.navigationItem.rightBarButtonItem = UIBarButtonItem(title: "Stop", style: .plain, target: self, action: #selector(self.stopRecording)) } } } @objc func stopRecording() { let recorder = RPScreenRecorder.shared() recorder.stopRecording { [unowned self] (preview, error) in self.navigationItem.rightBarButtonItem = UIBarButtonItem(title: "Start", style: .plain, target: self, action: #selector(self.startRecording)) if let unwrappedPreview = preview { unwrappedPreview.previewControllerDelegate = self self.present(unwrappedPreview, animated: true) } } } func previewControllerDidFinish(_ previewController: RPPreviewViewController) { dismiss(animated: true) } } Can record video, but no sound from webpage
Posted
by mtrucc.
Last updated
.