Unity3d 继承 Rest API接口
Canvas_x 发布于2016-03 浏览:1813 回复:2
0
收藏

Dictionary data = new Dictionary();


        data.Add("format", speechData.format);

        data.Add("rate", speechData.rate);

        data.Add("channel", speechData.channel);

        data.Add("cuid", speechData.cuid);

        data.Add("token", speechData.token);

        data.Add("speech", speechData.speech);


        string jsonDataPost = Json.Serialize(data);


        Dictionary headers = new Dictionary();


        headers.Add("Content-Type", "application/json");


        byte[] body = System.Text.Encoding.UTF8.GetBytes(jsonDataPost);



        WWW www = new WWW(speechUrl, body, headers);


        yield return www;


        Debug.Log(www.text);

返回值:{"err_msg":"parameters error.","err_no":3300,"sn":"858369483971459387237"}

收藏
点赞
0
个赞
共2条回复 最后由用户已被禁言回复于2022-04
#3fujiayi1984回复于2017-09

Canvas_x:

Dictionary data = new Dictionary();


        data.Add("format", speechData.format);

        data.Add("rate", speechData.rate);

        data.Add("channel", speechData.channel);

        data.Add("cuid", speechData.cuid);

        data.Add("token", speechData.token);

        data.Add("speech", speechData.speech);


        string jsonDataPost = Json.Serialize(data);


        Dictionary headers = new Dictionary();


        headers.Add("Content-Type", "application/json");


        byte[] body = System.Text.Encoding.UTF8.GetBytes(jsonDataPost);



        WWW www = new WWW(speechUrl, body, headers);


        yield return www;


        Debug.Log(www.text);

返回值:{"err_msg":"parameters error.","err_no":3300,"sn":"858369483971459387237"}

回复Canvas_x:请仔细核对文档及参照demo,核对输入参数

0
#2tanbikehan回复于2016-04

你没填len长度,

speechData.speech确保是base64没,不是2进制,而且一定要是能在播放器播放的speechData.format格式文件

0
TOP
切换版块