我在我的应用程序中使用replaykit,并且在用户完成录制之后,我提供了一个用于“共享”视频的按钮。我提供了RPPreviewViewController
,如果我点击视频中的播放,当我回到应用时,音频不起作用。只有当我回到之前的viewController
并回到录制的那个时,它才会起作用。RPPreviewViewController在播放后禁用音频
我的应用程序是一个音乐作曲应用程序,所以音频非常重要。我甚至试过正在重置的AVAudioSession
类别回放视图驳回像这样经过:
func showPreview() {
if let unwrappedPreview = self.preview {
unwrappedPreview.previewControllerDelegate = self
self.present(unwrappedPreview, animated: true, completion: nil)
} else {
let alert = UIAlertController(title: "No recordings to share", message: "By hitting the play or record button you can record a video of your composition to share with others. Once you hit stop, the recording will be saved and ready to share.", preferredStyle: .alert)
let okAction = UIAlertAction(title: "OK", style: .default, handler: nil)
alert.addAction(okAction)
self.present(alert, animated: true, completion: nil)
}
}
func previewControllerDidFinish(_ previewController: RPPreviewViewController) {
let audioSession = AVAudioSession.sharedInstance()
try! audioSession.setCategory(AVAudioSessionCategoryPlayback)
dismiss(animated: true)
}
我的解决方案是类似的。我们有一个播放MIDI的“合成器”(Synthesizer)对象,然后将其删除,然后制作一个新的工具。不幸的是,并没有真正解释发生了什么。 – CodyMace
这是一个非常时髦的控制器。我已经停止了断点,甚至在应用程序显示并且所有控件继续工作时甚至崩溃了。 – Jer
哈哈哇,这是搞砸了。 – CodyMace