Preetika
Preetika

Reputation: 804

LLSimpleCamera : AVAssetWriterInput appendSampleBuffer crashing

I am using LLSimpleCamera for recording a video. It's recording fine when I use rear camera but when I switch to front camera, app crashes and the error reported is

* Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '* -[AVAssetWriterInput appendSampleBuffer:] Media type of sample buffer must match receiver's media type ("soun")'

I have tried many of the stackOverflow posts but not able to fix crash. Can anyone let me know what can be the issue ?

Upvotes: 9

Views: 812

Answers (2)

Pragya Singla
Pragya Singla

Reputation: 254

Try to add below check

if ([connection.output connectionWithMediaType:AVMediaTypeVideo] == nil)

and also check front and rear conditions for the camera

Upvotes: 0

Preetika
Preetika

Reputation: 804

The answer to the question is :

Changing AVCaptureDeviceInput leads to AVAssetWriterStatusFailed

Thanks to Stackoverflow.

Upvotes: 2

Related Questions