how to handle cancelled and failed states of AVAssetWriter?

Viewed 37

Some of my users experience crash when they finish recording video. I setup everything correctly and this is happening only for %0.2 of the users. The crash happens when finishWriting is called.

I finally decide to check AVAssetWriter's status before I call below code;

videoInput?.markAsFinished()
videoWriter?.finishWriting 

now it is;

if videoWriter?.status == .writing {
            videoInput?.markAsFinished()
            videoWriter?.finishWriting 
             // some ui configurations
}

But what about the other cases .cancelled & .failed ? Is it necessary to call the following code again? What should I do if videoWriter?.status == .cancelled or videoWriter?.status == .failed?

videoInput?.markAsFinished()
videoWriter?.finishWriting 
0 Answers
Related