- Home /
No microphone sound in ReplayKit recording
Hi, I bumped into a really weird scenario and wondering if anyone has same experience and knows any solutions?
Weird scenario:
Screen recording microphone only works during the session that grants the microphone permission in pop-up dialog. After you kill and relaunch the app, the pop-up dialog won't show up (which is expected based on the documentation), but the microphone sound won't be included in the recording (in-app sound will). It seems like the system is remembering the permission wrong, and automatically start the recording without including microphone input.
The error can be easily reproduced with the modified codes from Unity documentation
using System;
using UnityEngine;
#if PLATFORM_IOS
using UnityEngine.iOS;
using UnityEngine.Apple.ReplayKit;
public class Replay : MonoBehaviour
{
string lastError = "";
void OnGUI()
{
if (!ReplayKit.APIAvailable)
{
return;
}
var recording = ReplayKit.isRecording;
string caption = recording ? "Stop Recording" : "Start Recording";
if (GUI.Button(new Rect(10, 10, 500, 200), caption))
{
try
{
recording = !recording;
if (recording)
{
// Enable microphone
ReplayKit.StartRecording(true);
}
else
{
ReplayKit.StopRecording();
}
}
catch (Exception e)
{
lastError = e.ToString();
}
}
GUI.Label(new Rect(10, 220, 500, 50), "Last error: " + ReplayKit.lastError);
GUI.Label(new Rect(10, 280, 500, 50), "Last exception: " + lastError);
if (ReplayKit.recordingAvailable)
{
if (GUI.Button(new Rect(10, 350, 500, 200), "Preview"))
{
ReplayKit.Preview();
}
if (GUI.Button(new Rect(10, 560, 500, 200), "Discard"))
{
ReplayKit.Discard();
}
}
}
}
#endif
I'm using Unity 2018.2.2 with iPhone 6s (iOS 12.3.1).
Your answer
Follow this Question
Related Questions
No Audio in ReplayKit recording 2017.3.0f3 1 Answer
How to record the AudioListener without it playing the microphone on the speakers? 1 Answer
How to check camera permission in ios app? 1 Answer
Microphone on iOS check if permission given 2 Answers
Take Audio in from Mic but not play it out over speakers iOS 0 Answers