public IEnumerator <object> PersonAnalysisRequest(byte[] bytes) { var headers = new Dictionary <string, string>() { { "Ocp-Apim-Subscription-Key", Constants.MCS_COMPUTERVISIONKEY }, { "Content-Type", "application/octet-stream" } }; string requestParameters = "?visualFeatures=Faces&language=en"; string uri = Constants.MCS_BASEURL + "/vision/v3.0/analyze" + requestParameters; //if ((bytes != null) && (bytes.Length > 0)) //{ WWW www = new WWW(uri, bytes, headers); yield return(www); if (www.error != null) { Debug.Log(www.error); } else { PDResults results = JsonUtility.FromJson <PDResults>(www.text); PlayVoiceMessage.Instance.PlayTextToSpeechMessage(results); } //} }
public void PlayTextToSpeechMessage(PDResults result) { string message = string.Empty; if (result.faces.Count == 0) { message = "No people were detected on your path"; } else { message = (result.faces.Count == 1) ? "1 person detected on the path" : result.faces.Count + " people detected on the path"; } // Try and get a TTS Manager TextToSpeech tts = null; if (photoCaptureManagerGmObj != null) { tts = photoCaptureManagerGmObj.GetComponent <TextToSpeech>(); } if (tts != null) { //Play voice message tts.StartSpeaking(message); } }