* 有声内容播放功能与音乐播放类似,但其播放的不是歌曲,而是小说、相声、脱口秀、段子等有声音频。播放的处理器是TingPlayProcessor,而播放控制则在MusicPlayProcessor。开发者可以在[灵聚开发者平台](http://dev.lingju.ai)选择该场景的播放来源。若选择考拉FM则需要开发者自行到考拉FM开放平台申请appid、appSceret等,并将这些信息填入如下图所示的输入框中。
![](https://box.kancloud.cn/5435f18e9d025dae44ecefc8b763d899_1203x361.png)
![](https://box.kancloud.cn/8a165e0140e9963eadb19c6c1f80883c_798x105.png)
![](https://box.kancloud.cn/a82b1a0f61c64428260f22b4905e7984_1010x203.png)
* 对接第三方资源
APP当前接入的第三方资源是喜马拉雅,因此需要开发者申请对应的appkey(见第 2.2 节)。对话回复内容如下:
~~~
输入:播放岳云鹏的相声
输出:
{
"actions": [
{
"action": "QUERY",
"target": {
"id": 100,
"recyle": 0,
"release": 0,
"singer": [
"岳云鹏"
],
"type": "相声"
}
},
{
"action": "SET",
"target": {
"control": "PLAY",
"id": 300,
"origin": "XIMALAYA",
"type": "AUDIO"
}
}
],
"motions": [
...
],
"outc": "1",
"rtext": "好的",
"synthetise": "",
"ttext": ""
}
语义解析:查询(action1:“QUERY”)singer是岳云鹏、type是相声的音频(动作id=100),
然后播放(action2的control:PLAY),来源是喜马拉雅(origin: “XIMALAYA“)。
~~~
* 考拉FM
~~~
输入:播放脱口秀
输出:
{
"actions": [
{
"action": "VIEW",
"target": {
"albumId": 1100000000747,
"coverUrl": "http://img.kaolafm.net/mz/images/201412/57027d68-bd12-45b1-97a3-d92daf5549a4/default.jpg",
"episode": 1506,
"hot": 109865766,
"id": 316,
"lastAudio": {
"album": "1100000000747",
"audioPic": "http://img.kaolafm.net/mz/images/201412/57027d68-bd12-45b1-97a3-d92daf5549a4/default.jpg",
"created": 1503676800000,
"duration": 293340,
"episode": 1506,
"id": 100,
"musicId": "1000010006940",
"name": "【七夕特别节目】请你过一个有烛光的情人节吧",
"recyle": 0,
"url": "http://image.kaolafm.net/mz/aac_32/201708/ab30ba30-57e0-4c04-b68d-77ce626078da.aac"
},
"name": "情感治愈系",
"recyle": 0,
"singer": "寒霜",
"tag": "情感 治愈 暖心故事 励志 寒霜"
}
},
...
],
"outc": 1,
"rtext": "我帮你找到了一些专辑",
"ttext": "第一个/第二个"
}
语义解析:展示(action=“VIEW”)找到的多个专辑(动作id=316),并选择播放第几个。
~~~
* 页面效果图:
![](https://box.kancloud.cn/e92381585c27653ec3ae092a964495dd_198x357.png)--![](https://box.kancloud.cn/9b4f21a385a1ac57de6c6f4cb1e1744d_198x356.png)