ARVideoKit icon indicating copy to clipboard operation
ARVideoKit copied to clipboard

App crashes when user tries to start record when using Skype (or other mic related app)

Open pionl opened this issue 6 years ago • 4 comments

The crash:

Fatal Exception: NSInvalidArgumentException *** -[AVAssetWriterInput initWithMediaType:outputSettings:sourceFormatHint:] 4 is not a valid channel count for Format ID 'aac '. Use kAudioFormatProperty_AvailableEncodeNumberChannels (<AudioToolbox/AudioFormat.h>) to enumerate available channel counts for a given format.

Fatal Exception: NSInvalidArgumentException
0  CoreFoundation                 0x186d31d04 __exceptionPreprocess
1  libobjc.A.dylib                0x185f80528 objc_exception_throw
2  AVFoundation                   0x18c5c5a04 -[AVAssetWriterInput dealloc]
3  ARVideoKit                     0x101bac6bc (Missing)
4  ARVideoKit                     0x101bacd8c (Missing)
5  ARVideoKit                     0x101bb41b4 (Missing)
6  AudioToolbox                   0x18a94be60 AudioSessionRequestRecordPermission
7  AVFAudio                       0x18c4e5d18 -[AVAudioSession requestRecordPermission:]

pionl avatar Feb 01 '18 08:02 pionl

@pionl,

Due to some limitation in iOS, you cannot use a microphone while it's being used by another application (e.g. FaceTime, Skype, Phone... etc.). However, there's a workaround this issue in order to enable recording videos while using Skype or similar apps.

Although you'll be able to record a video, the video won't have any audio included. To make this happen, you will have to disable the audio recording by setting enableAudio to false when the device's microphone isn't available.

I may be able to assist you in code if you share a snippet of your code.

-Ahmed

AFathi avatar Feb 02 '18 14:02 AFathi

Hi Ahmed,

I thought it will be the issue. Unfortunately I didn't find any code that would allow me to detect if the microphone is already used. Do you have any code for it?

Also I'm trying to use Voicemod which uses microphone too (same error), is there any way to feed wav file and the end to the video? (on stop). Only if there is post processing in the library. Otherwise I would need to merge the audio / video at the end.

Thank you, Martin

pionl avatar Feb 02 '18 15:02 pionl

@AFathi How you founded any code?

pionl avatar Mar 13 '18 14:03 pionl

bump. I was wondering if a integrate solution within the framework would be a better choice!

anushkmittal avatar May 17 '18 19:05 anushkmittal