iphone - AVAssetWriter fails once App goes in background -
i working on ios app in creating video images. using avassetwriter achieve this. works fine. when app goes in background , switched back, video writing fails. avassetwriter's finishwritingwithcompletionhandler not getting called when switch app.
may duplicate of avassetwriter fails when application enters background during rendering , not getting there.
any idea this?
thanks
this answer based on assumption want video continue rendering while in background.
i fixed in app doing asking os grant app background task permisions (for limited amount of time). answer might ios generating video in background task
@property (nonatomic,assign) uibackgroundtaskidentifier __block backgroundrenderingid; uiapplication *app = [uiapplication sharedapplication]; _backgroundrenderingid = [app beginbackgroundtaskwithexpirationhandler:^{ [app endbackgroundtask:_backgroundrenderingid]; _backgroundrenderingid = uibackgroundtaskinvalid; }]; don't forget let go once done!
[[uiapplication sharedapplication] endbackgroundtask:_backgroundrenderingid];
Comments
Post a Comment