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][1]), 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][2]
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).
[1]: https://docs.unity3d.com/ScriptReference/Apple.ReplayKit.ReplayKit.StartRecording.html
[2]: https://docs.unity3d.com/ScriptReference/Apple.ReplayKit.ReplayKit.html
↧