Exemple #1
0
    IEnumerator FaceAPIPost(byte[] postData)
    {
        Debug.Log("call FaceAPIPost");

        if (postData == null || postData.Length <= 0)
        {
            yield return(null);
        }
        //postData = LoadBytes("Assets/Resources/Images/pd.jpg");
        Debug.Log("Post Data: " + postData.Length + "[bytes]");

        // HTTP Header
        var headers = new Dictionary <string, string>()
        {
            { "Ocp-Apim-Subscription-Key", "eee6fea1670f4b059b0b9aa95a37a951" },
            { "Content-Type", "application/octet-stream" }
        };

        // サーバからJSON文字列取得
        WWW www = new WWW(url, postData, headers);

        yield return(www);

        // FaceAPIのレスポンスから表情のパラメータを取り出す
        Dictionary <string, double> paramsDict = parseFaceAPIResponse(www.text);

        _UICon.updateUI(paramsDict);

        // 表情のパラメータを相手に送信する
        _PhCon.SendFaceParamToOthers(paramsDict);
    }