Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Starting AVAssetExportSession in the Background

My app does some processing and at some point it needs to call an AVAssetExportSession.

If the session has already started and then I background the app, everything completes normally. However, if I background the app before calling exportAsynchronouslyWithCompletionHandler. I get this error:

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}

Is it possible to start an AVAssetExportSession in the background?

like image 803
Dex Avatar asked Mar 23 '12 21:03

Dex


2 Answers

It actually is not possible due to the fact that you can't start a new thread in the background. If you want to do a lot of things in the background you'll have to start them all asynchronously right before the app backgrounds.

like image 128
Dex Avatar answered Oct 23 '22 01:10

Dex


You can start AVAssetExportSession in background. The only limitations in AVFoundation to performing work in the background, are using AVVideoCompositions or AVMutableVideoCompositions. AVVideoCompositions are using the GPU, and the GPU cannot be used in the background.

like image 34
Vasyl Avatar answered Oct 23 '22 00:10

Vasyl