Created
October 9, 2020 18:01
-
-
Save manwithsteelnerves/f7e8b2fa0265478effc907e796cf6b43 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void OnEnable() | |
{ | |
ReplayKitManager.DidRecordingStateChange += DidRecordingStateChange; | |
} | |
private void OnDisable() | |
{ | |
ReplayKitManager.DidRecordingStateChange += DidRecordingStateChange; | |
} | |
public void StopRecording() | |
{ | |
if (ReplayKitManager.IsRecording()) | |
{ | |
ReplayKitManager.StopRecording(); | |
} | |
} | |
private void DidRecordingStateChange(ReplayKitRecordingState state, string message) | |
{ | |
Debug.Log("Received Event Callback : DidRecordingStateChange [State:" + state.ToString() + " " + "Message:" + message); | |
switch(state) | |
{ | |
case ReplayKitRecordingState.Started: | |
Debug.Log("ReplayKitManager.DidRecordingStateChange : Video Recording Started"); | |
break; | |
case ReplayKitRecordingState.Stopped: | |
Debug.Log("ReplayKitManager.DidRecordingStateChange : Video Recording Stopped"); | |
break; | |
case ReplayKitRecordingState.Failed: | |
Debug.Log("ReplayKitManager.DidRecordingStateChange : Video Recording Failed with message [" + message+"]"); | |
break; | |
case ReplayKitRecordingState.Available: | |
Debug.Log("ReplayKitManager.DidRecordingStateChange : Video Recording available for preview"); | |
ReplayKitManager.SavePreview((error) => | |
{ | |
SetStatus("Saved preview to gallery with error : " + ((error == null) ? "null" : error)); | |
textMessage.SetActive(true); | |
}); | |
break; | |
default: | |
Debug.Log("Unknown State"); | |
break; | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment