void Start() { if (OnlyWebGL.WebGLSpeechDetectionPluginIsAvailable()) { OnlyWebGL.WebGLSpeechDetectionPluginInit(); } }
public bool IsAvailable() { #if UNITY_WEBGL && !UNITY_EDITOR return(OnlyWebGL.WebGLSpeechDetectionPluginIsAvailable()); #else return(false); #endif }
void FixedUpdate() { if (OnlyWebGL.WebGLSpeechDetectionPluginGetNumberOfResults() > 0) { string jsonData = OnlyWebGL.WebGLSpeechDetectionPluginGetResult(); if (string.IsNullOrEmpty(jsonData)) { return; } DetectionResult detectionResult = JsonUtility.FromJson <DetectionResult>(jsonData); if (null != detectionResult) { Invoke(detectionResult); } } }
public void GetLanguages(Action <LanguageResult> callback) { #if UNITY_WEBGL && !UNITY_EDITOR string jsonData = OnlyWebGL.WebGLSpeechDetectionPluginGetLanguages(); if (string.IsNullOrEmpty(jsonData)) { Debug.LogError("GetLanguages: Languages are empty!"); callback.Invoke(null); return; } //Debug.Log("GetLanguages=" + jsonData); LanguageResult languageResult = JsonUtility.FromJson <LanguageResult>(jsonData); callback.Invoke(languageResult); return; #else callback.Invoke(null); #endif }
public void StopRecognition() { #if UNITY_WEBGL && !UNITY_EDITOR OnlyWebGL.WebGLSpeechDetectionPluginStop(); #endif }
public void Abort() { #if UNITY_WEBGL && !UNITY_EDITOR OnlyWebGL.WebGLSpeechDetectionPluginAbort(); #endif }
public void SetLanguage(string dialect) { #if UNITY_WEBGL && !UNITY_EDITOR OnlyWebGL.WebGLSpeechDetectionPluginSetLanguage(dialect); #endif }