AVExportSession在后台运行

我正在处理一个需要合并多个video的应用程序。 我正在使用AVExportSession导出合并的video。 我也显示导出video的进度条。 它正常运行正常。

当我们locking屏幕或将应用程序置于后台模式时,就会出现这个问题。 这次如果正在处理导出,则在将应用程序置于后台模式后立即失败。 我也试图使用后台任务。 检查下面的代码。

 bgTask = [[UIApplication sharedApplication] beginBackgroundTaskWithExpirationHandler:^{ // Clean up any unfinished task business by marking where you. // stopped or ending the task outright. [[UIApplication sharedApplication] endBackgroundTask:bgTask]; bgTask = UIBackgroundTaskInvalid; }]; 

但是这似乎不起作用。 我究竟做错了什么? 任何帮助,将不胜感激。

不幸的是,由于AVAssetExportSession使用gpu来完成它的一些工作,所以如果你使用AVVideoComposition ,它不能在后台运行。