9

我的应用程序进行了一些处理,在某些时候它需要调用 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?

4

3 回答 3

5

这实际上是不可能的,因为您无法在后台启动新线程。如果你想在后台做很多事情,你必须在应用程序背景之前异步启动它们。

于 2012-07-01T09:41:43.350 回答
4

您可以AVAssetExportSession在后台启动。AVFoundation在后台执行工作的唯一限制是使用AVVideoCompositionsor AVMutableVideoCompositionsAVVideoCompositions正在使用GPU,并且GPU不能在后台使用。

于 2013-01-26T14:52:39.573 回答
-1

我找到了一个适用于音频的解决方案,我没有尝试过视频

如果您更新项目功能中的“背景模式”设置以包含音频。它将允许导出。

这是为了在后台播放音乐。

于 2014-09-05T14:48:29.677 回答