我在我的應用程序中使用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