void HandleMicPrivilegeResult(bool canRecord) { #if PLATFORM_LUMIN && !UNITY_EDITOR _micPrivilegeHandler.OnMicPrivilegeResult -= HandleMicPrivilegeResult; _canRecord = canRecord; #endif if (!canRecord) { _canRecord = false; OnSpeechStateUpdated?.Invoke(SpeechToTextStates.MicrophoneUnavailable); } }
protected virtual void Awake() { SetupSingleton(); #if PLATFORM_LUMIN && !UNITY_EDITOR _ = MLPrivileges.RequestPrivilegesAsync(MLPrivileges.Id.ComputerVision).ContinueWith((x) => { if (!x.Result.IsOk && x.Result != MLResult.Code.PrivilegeGranted) { _canRecord = false; OnSpeechStateUpdated?.Invoke(SpeechToTextStates.MicrophoneUnavailable); return; } _canRecord = true; }); #else _canRecord = true; #endif }
protected void FireOnSpeechStateUpdated(SpeechToTextStates state) { OnSpeechStateUpdated?.Invoke(state); }