Error with Video Player and Microphone Recording on iOS

I am working on a project that playing a video, and recording the player audio response on the same time.
I am using Unity 2017.2.2f1 on iOS. I have setup a scene with video player and a microphone recording (by Microphone.Start() ). I am facing the 2 problems.

First, if I play a video clip first, then start the microphone recording. The audio part of the video clip will be muted after started the microphone recording 3 seconds. But the video is still playing, and the mic is still recording. iOS will return following error on xCode:“AVAudioSession.mm:1049:-[Deactivating an audio session that has running I/O. All I/O should be stopped or paused prior to deactivating the audio session.”

Second, if I start the microphone recording, then play a video clip. The video clip would be perfectly played on both screen and audio. However, the recording clip will be faster than normal.

BTW, I have tried to do a bug report. But it stopped at the middle when uploading the report for over 2 hours.

3 Likes

Have you found the fix for this yet?

Hi, I have the exact same problem. I’m using a Video Player with videos coming from the Device Camera using GitHub - yasirkula/UnityNativeCamera: A native Unity plugin to take pictures/record videos with device camera on Android & iOS. I’m also recording an audio using Unity’s Microphone API.
Do you guys @OneLemon and @BillyCY have found any solutions?

I’m currently trying to debug the issue using this GitHub - cbaltzer/UnitySpeakerFix: Forces audio to speaker while using the mic, on iPhone repo fix along with using “Prepare iOS for Recording” option on the Build Settings.

I will keep posting here.

Thanks.

Has anyone had any luck with this?

I get this problem also when I play a rewarded video sometimes.