在后台启动AVAssetExportSession
我的应用程序做了一些处理,在某些时候需要调用一个AVAssetExportSession。
如果会话已经开始,然后我背景的应用程序,一切正常完成。 但是,如果我在调用exportAsynchronouslyWithCompletionHandler
之前后台应用程序。 我得到这个错误:
AVAssetExportSessionStatusFailed Error Domain=AVFoundationErrorDomain Code=-11800 "The operation could not be completed" UserInfo=0x1e550db0 {NSLocalizedFailureReason=An unknown error occurred (-12985), NSUnderlyingError=0x1e574910 "The operation couldn’t be completed. (OSStatus error -12985.)", NSLocalizedDescription=The operation could not be completed}
是否有可能在后台启动AVAssetExportSession?
这实际上是不可能的,因为你不能在后台启动一个新的线程。 如果你想在后台做很多事情,你必须在应用背景之前asynchronous启动它们。
您可以在后台启动AVAssetExportSession
。 AVFoundation
在后台执行工作的唯一限制是使用AVVideoCompositions
或AVMutableVideoCompositions
。 AVVideoCompositions
正在使用GPU,并且GPU不能在后台使用。
我find了一个适用于audio的解决scheme,我没有试过video
如果您在项目的function中更新“背景模式”设置以包含audio。 这将允许出口。
这是为了在后台播放音乐。
- AVExportSession在后台运行
- iOS:在video中裁剪video奇怪的绿线左侧和底侧
- Swift – 压缩video文件
- 在iOS中裁剪和修复video方向
- 使用AVFoundation裁剪AVAssetvideo
- AVAssetExportSession导出失败,带有错误:“操作已停止,NSLocalizedFailureReason =video无法合成。
- AVAssetExportSession每次都失败(错误-12780)
- 如何使用AVAssetWriter制作缩小尺寸的video?
- 模拟AVLayerVideoGravityResizeAspectFill:裁剪和中心video模仿预览,而不会失去清晰度