AVExportSession to run in background

末鹿安然 提交于 2020-01-04 02:39:12

问题


I am working on one application in which it requires to merge more than one videos. I am using AVExportSession to export merged video. I am also displaying progress bar for exporting video. It is running correctly most of times.

The issue occurs when we lock the screen or put application in background mode. This time if exporting is in process, it immediately fails after putting application in background mode. I have also tried to use background task. Check below code.

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;
}];

But this does not seem to work. What am I doing wrong? Any help would be appreciated.


回答1:


Sadly, since AVAssetExportSession uses the gpu to do some of it's work, it cannot run in the background if you are using an AVVideoComposition.



来源:https://stackoverflow.com/questions/16439317/avexportsession-to-run-in-background

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!