-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from wanan99/patch-3
Update rules-tts.md
- Loading branch information
Showing
1 changed file
with
37 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,37 @@ | ||
# 自定义TTS | ||
# 自定义TTS | ||
## 请求示例 | ||
```javascript | ||
// 请求地址 | ||
let url = 'https://www.baidu.com'; | ||
|
||
// 请求参数 | ||
let params = { | ||
type: 'zh-linzhilin', | ||
text: '你好,世界!' | ||
}; | ||
|
||
// 请求header | ||
let header = { | ||
token: 'xxx' | ||
}; | ||
|
||
// POST请求,具体参考文档 native-to-js | ||
let response = await app.post({ | ||
url, | ||
params, | ||
header | ||
}); | ||
|
||
// 如果responseBody是一个json字符串 | ||
let json = app.stringToJson(response.responseBody); | ||
|
||
// 获取到语音文件的地址 | ||
let voiceUrl = json.url; | ||
|
||
return { | ||
url: voiceUrl, // 语音请求地址 | ||
method: 'GET', // 请求方式 | ||
params: {}, // 携带的参数 | ||
header: {}, // 携带的header | ||
cookie: {} // 携带的cookie | ||
}; |