AI Live
2020-08-05 本文已影响0人
丨逐风者丨
1.进入AI直播 参数:liveId,version
2.显示模拟拨号动画
3.加载直播详情 https://api.budsedu.com/course/ailive/?live_id=1&version=1
{
"id": 1,
"name": "What is it - A",
"sample": [{
"id": 1,
"name": "basic",
"path": "http://buds-dev.oss-cn-shenzhen.aliyuncs.com/AILive%2Fbasic%2F1-01_1cqVi1r.mp4",
"type": 1
}, {
"id": 2,
"name": "basic",
"path": "http://buds-dev.oss-cn-shenzhen.aliyuncs.com/AILive%2Fbasic%2F1-02_Re0l3LK.mp4",
"type": 1
}, {
"id": 3,
"name": "basic",
"path": "http://buds-dev.oss-cn-shenzhen.aliyuncs.com/AILive%2Fbasic%2F1-03_2AjwZCm.mp4",
"type": 1
}, {
"id": 4,
"name": "basic",
"path": "http://buds-dev.oss-cn-shenzhen.aliyuncs.com/AILive%2Fbasic%2F1-1_q5R1Lap.mp4",
"type": 1
}, {
"id": 5,
"name": "basic",
"path": "http://buds-dev.oss-cn-shenzhen.aliyuncs.com/AILive%2Fbasic%2F1-2_L6r9o3z.mp4",
"type": 1
}, {
"id": 6,
"name": "basic",
"path": "http://buds-dev.oss-cn-shenzhen.aliyuncs.com/AILive%2Fbasic%2F1-3_D7qZ7XL.mp4",
"type": 1
}, {
"id": 7,
"name": "basic",
"path": "http://buds-dev.oss-cn-shenzhen.aliyuncs.com/AILive%2Fbasic%2F1-4_ORUydby.mp4",
"type": 1
}, {
"id": 8,
"name": "basic",
"path": "http://buds-dev.oss-cn-shenzhen.aliyuncs.com/AILive%2Fbasic%2F3-1_9GBaZeO.mp4",
"type": 1
}, {
"id": 9,
"name": "basic",
"path": "http://buds-dev.oss-cn-shenzhen.aliyuncs.com/AILive%2Fbasic%2F3-2_GkxMYIY.mp4",
"type": 1
}, {
"id": 10,
"name": "basic",
"path": "http://buds-dev.oss-cn-shenzhen.aliyuncs.com/AILive%2Fbasic%2F3-3_3Gpd0cF.mp4",
"type": 1
}, {
"id": 11,
"name": "basic",
"path": "http://buds-dev.oss-cn-shenzhen.aliyuncs.com/AILive%2Fbasic%2F3-4_W36SkMH.mp4",
"type": 1
}, {
"id": 12,
"name": "basic",
"path": "http://buds-dev.oss-cn-shenzhen.aliyuncs.com/AILive%2Fbasic%2F2-1_JTrovjz.mp4",
"type": 1
}, {
"id": 13,
"name": "basic",
"path": "http://buds-dev.oss-cn-shenzhen.aliyuncs.com/AILive%2Fbasic%2F2-2_bFiIZwr.mp4",
"type": 1
}, {
"id": 14,
"name": "basic",
"path": "http://buds-dev.oss-cn-shenzhen.aliyuncs.com/AILive%2Fbasic%2F2-3_CUJZtSR.mp4",
"type": 1
}, {
"id": 15,
"name": "basic",
"path": "http://buds-dev.oss-cn-shenzhen.aliyuncs.com/AILive%2Fbasic%2F2-4_i6ccq7K.mp4",
"type": 1
}, {
"id": 16,
"name": "basic",
"path": "http://buds-dev.oss-cn-shenzhen.aliyuncs.com/AILive%2Fbasic%2F4-1_14MHt83.mp4",
"type": 1
}, {
"id": 17,
"name": "basic",
"path": "http://buds-dev.oss-cn-shenzhen.aliyuncs.com/AILive%2Fbasic%2F4-2_xDScZtm.mp4",
"type": 1
}, {
"id": 18,
"name": "basic",
"path": "http://buds-dev.oss-cn-shenzhen.aliyuncs.com/AILive%2Fbasic%2F4-3_xRfodr2.mp4",
"type": 1
}, {
"id": 19,
"name": "basic",
"path": "http://buds-dev.oss-cn-shenzhen.aliyuncs.com/AILive%2Fbasic%2F4-4_2r4nKld.mp4",
"type": 1
}, {
"id": 31,
"name": "basic",
"path": "http://buds-dev.oss-cn-shenzhen.aliyuncs.com/AILive%2Fbasic%2Fstandup.mp4",
"type": 1
}, {
"id": 20,
"name": "basic",
"path": "http://buds-dev.oss-cn-shenzhen.aliyuncs.com/AILive%2Fbasic%2F2_jxovxVW.mp4",
"type": 1
}],
"ue": [{
"id": 21,
"name": "ecp1",
"path": "http://buds-dev.oss-cn-shenzhen.aliyuncs.com/AILive%2Fecp1%2FUE-3_HAwqqty.mp4",
"type": 2
}, {
"id": 22,
"name": "ecp2",
"path": "http://buds-dev.oss-cn-shenzhen.aliyuncs.com/AILive%2Fecp2%2FUE-2_zaNi9tm.mp4",
"type": 2
}, {
"id": 23,
"name": "err1",
"path": "http://buds-dev.oss-cn-shenzhen.aliyuncs.com/AILive%2Ferr1%2FUE-4_hgDLViS.mp4",
"type": 2
}, {
"id": 24,
"name": "err2",
"path": "http://buds-dev.oss-cn-shenzhen.aliyuncs.com/AILive%2Ferr2%2FUE-5_il8bcDR.mp4",
"type": 2
}, {
"id": 25,
"name": "standby",
"path": "http://buds-dev.oss-cn-shenzhen.aliyuncs.com/AILive%2Fstandby%2FQT.mp4",
"type": 2
}, {
"id": 26,
"name": "good",
"path": "http://buds-dev.oss-cn-shenzhen.aliyuncs.com/AILive%2Fgood%2FUE-7_qbd846n.mp4",
"type": 2
}, {
"id": 27,
"name": "great",
"path": "http://buds-dev.oss-cn-shenzhen.aliyuncs.com/AILive%2Fgreat%2FUE-8_EmwBNrv.mp4",
"type": 2
}, {
"id": 28,
"name": "wonderful",
"path": "http://buds-dev.oss-cn-shenzhen.aliyuncs.com/AILive%2Fwonderful%2FUE-9_SMosHNE.mp4",
"type": 2
}, {
"id": 29,
"name": "perfect",
"path": "http://buds-dev.oss-cn-shenzhen.aliyuncs.com/AILive%2Fperfect%2FUE-10_xvH93uf.mp4",
"type": 2
}, {
"id": 30,
"name": "back",
"path": "http://buds-dev.oss-cn-shenzhen.aliyuncs.com/AILive%2Fback%2FUE-11.mp4",
"type": 2
}],
"url": "http://game.budsedu.com/dev/1a/web-mobile"
}
4.下载接口返回的sample和ue两个视频列表
5.WebView加载接口返回的url
6.视频下载完成,开始AI直播
7.播放第一个视频(规定为 自我介绍)
8.视频播放途中会收Cocos发来的消息,Native将消息缓存到内存,视频播放完成后再解析
9.解析Cocos上一次发来的消息
int type = mLastActionBean.getType();
switch (type) {
case AIJSActionBean.ACTION_WORD:// 6001
case AIJSActionBean.ACTION_SENTENCE:// 6002
if (mLastActionBean.isErrorRetry()) {// 是否是失败重试
aiLog(">>错误重读,不切换游戏场景");
startEvaluating();// 开启语音评测
mLastActionBean.setErrorRetry(false);
break;
} else if (!mLastActionBean.isHasAnalysis()) {
// 如果用户还没有触发跟读,则触发跟读
aiLog(">>用户还没有触发跟读,触发跟读");
onSpeech();
break;
} else {
aiLog(">>已处理语音评测,执行下一步");
// 这里没有break,所以会执行case AIJSActionBean.ACTION_WAIT:里面的内容
}
case AIJSActionBean.ACTION_WAIT:// 6003
// 切换游戏场景
aiLog(">>切换游戏场景");
onLoadScene();// 告知Cocos切换场景
// 播放下一个视频
aiLog(">>播放下一个视频");
playNextVideo();
break;
case AIJSActionBean.ACTION_FINISH:// 6004
// 处理AI直播结束事件
aiLog("处理AI直播结束事件");
runOnUiThread(this::onAILiveFinish);
break;
}
10.逻辑处理完后,执行playNextVideo来播放下一个视频,然后就一直重复第8,9,10
11.收到6004 结束AI直播 上传学习报告和直播视频
Logs
2020-08-03 20:34:05.165 14234-14234/? W/AILive/D: 1.进入AI直播
2020-08-03 20:34:05.170 14234-14234/? W/AILive/D: >>>开始AI直播,ID = 1
2020-08-03 20:34:05.170 14234-14234/? W/AILive/D: >>>播放等待音效和动画
2020-08-03 20:34:05.196 14234-14234/? W/AILive/D: >>>从服务器拉取直播信息,mLiveId = 1
2020-08-03 20:34:05.199 14234-14234/? W/AILive/D: >>>初始化MediaPlayer,无缝播放全靠他
2020-08-03 20:34:05.385 14234-14234/? W/AILive/D: >>>onSurfaceTextureAvailable
2020-08-03 20:34:05.696 14234-14234/? W/AILive/D: >>>拉取直播数据成功, result ={"checked":false,"id":1,"name":"What is it - A","sample":[{"id":1,"name":"basic","path":"http://buds-dev.oss-cn-shenzhen.aliyuncs.com/AILive%2Fbasic%2F1-01_1cqVi1r.mp4","type":1},{"id":2,"name":"basic","path":"http://buds-dev.oss-cn-shenzhen.aliyuncs.com/AILive%2Fbasic%2F1-02_Re0l3LK.mp4","type":1},{"id":3,"name":"basic","path":"http://buds-dev.oss-cn-shenzhen.aliyuncs.com/AILive%2Fbasic%2F1-03_2AjwZCm.mp4","type":1},{"id":4,"name":"basic","path":"http://buds-dev.oss-cn-shenzhen.aliyuncs.com/AILive%2Fbasic%2F1-1_q5R1Lap.mp4","type":1},{"id":5,"name":"basic","path":"http://buds-dev.oss-cn-shenzhen.aliyuncs.com/AILive%2Fbasic%2F1-2_L6r9o3z.mp4","type":1},{"id":6,"name":"basic","path":"http://buds-dev.oss-cn-shenzhen.aliyuncs.com/AILive%2Fbasic%2F1-3_D7qZ7XL.mp4","type":1},{"id":7,"name":"basic","path":"http://buds-dev.oss-cn-shenzhen.aliyuncs.com/AILive%2Fbasic%2F1-4_ORUydby.mp4","type":1},{"id":8,"name":"basic","path":"http://buds-dev.oss-cn-shenzhen.aliyuncs.com/AILive%2Fbasic%2F3-1_9GBaZeO.mp4","type":1},{"id":9,"name":"basic","path":"http://buds-dev.oss-cn-shenzhen.aliyuncs.com/AILive%2Fbasic%2F3-2_GkxMYIY.mp4","type":1},{"id":10,"name":"basic","path":"http://buds-dev.oss-cn-shenzhen.aliyuncs.com/AILive%2Fbasic%2F3-3_3Gpd0cF.mp4","type":1},{"id":11,"name":"basic","path":"http://buds-dev.oss-cn-shenzhen.aliyuncs.com/AILive%2Fbasic%2F3-4_W36SkMH.mp4","type":1},{"id":12,"name":"basic","path":"http://buds-dev.oss-cn-shenzhen.aliyuncs.com/AILive%2Fbasic%2F2-1_JTrovjz.mp4","type":1},{"id":13,"name":"basic","path":"http://buds-dev.oss-cn-shenzhen.aliyuncs.com/AILive%2Fbasic%2F2-2_bFiIZwr.mp4","type":1},{"id":14,"name":"basic","path":"http://buds-dev.oss-cn-shenzhen.aliyuncs.com/AILive%2Fbasic%2F2-3_CUJZtSR.mp4","type":1},{"id":15,"name":"basic","path":"http://buds-dev.oss-cn-shenzhen.aliyuncs.com/AILive%2Fbasic%2F2-4_i6ccq7K.mp4","type":1},{"id":16,"name":"basic","path":"http://buds-dev.oss-cn-shenzhen.aliyuncs.com/AILive%2Fbasic%2F4-1_14MHt83.mp4","type":1},{"id":17,"name":"basic","path":"http://buds-dev.oss-cn-shenzhen.aliyuncs.com/AILive%2Fbasic%2F4-2_xDScZtm.mp4","type":1},{"id":18,"name":"basic","path":"http://buds-dev.oss-cn-shenzhen.aliyuncs.com/AILive%2Fbasic%2F4-3_xRfodr2.mp4","type":1},{"id":19,"name":"basic","path":"http://buds-dev.oss-cn-shenzhen.aliyuncs.com/AILive%2Fbasic%2F4-4_2r4nKld.mp4","type":1},{"id":31,"name":"basic","path":"http://buds-dev.oss-cn-shenzhen.aliyuncs.com/AILive%2Fbasic%2Fstandup.mp4","type":1},{"id":20,"name":"basic","path":"http://buds-dev.oss-cn-shenzhen.aliyuncs.com/AILive%2Fbasic%2F2_jxovxVW.mp4","type":1}],"ue":[{"id":21,"name":"ecp1","path":"http://buds-dev.oss-cn-shenzhen.aliyuncs.com/AILive%2Fecp1%2FUE-3_HAwqqty.mp4","type":2},{"id":22,"name":"ecp2","path":"http://buds-dev.oss-cn-shenzhen.aliyuncs.com/AILive%2Fecp2%2FUE-2_zaNi9tm.mp4","type":2},{"id":23,"name":"err1","path":"http://buds-dev.oss-cn-shenzhen.aliyuncs.com/AILive%2Ferr1%2FUE-4_hgDLViS.mp4","type":2},{"id":24,"name":"err2","path":"http://buds-dev.oss-cn-shenzhen.aliyuncs.com/AILive%2Ferr2%2FUE-5_il8bcDR.mp4","type":2},{"id":25,"name":"standby","path":"http://buds-dev.oss-cn-shenzhen.aliyuncs.com/AILive%2Fstandby%2FQT.mp4","type":2},{"id":26,"name":"good","path":"http://buds-dev.oss-cn-shenzhen.aliyuncs.com/AILive%2Fgood%2FUE-7_qbd846n.mp4","type":2},{"id":27,"name":"great","path":"http://buds-dev.oss-cn-shenzhen.aliyuncs.com/AILive%2Fgreat%2FUE-8_EmwBNrv.mp4","type":2},{"id":28,"name":"wonderful","path":"http://buds-dev.oss-cn-shenzhen.aliyuncs.com/AILive%2Fwonderful%2FUE-9_SMosHNE.mp4","type":2},{"id":29,"name":"perfect","path":"http://buds-dev.oss-cn-shenzhen.aliyuncs.com/AILive%2Fperfect%2FUE-10_xvH93uf.mp4","type":2},{"id":30,"name":"back","path":"http://buds-dev.oss-cn-shenzhen.aliyuncs.com/AILive%2Fback%2FUE-11.mp4","type":2}],"url":"http://game.budsedu.com/dev/1a/web-mobile"}
2020-08-03 20:34:05.697 14234-14234/? W/AILive/D: >>>游戏地址:http://game.budsedu.com/dev/1a/web-mobile
2020-08-03 20:34:05.719 14234-14234/? W/AILive/D: >>>开始下载直播资源...
2020-08-03 20:34:09.113 14234-14883/? W/AILive/D: >>>收到JS发来的信息:{"type":"6003","content":"ready","args":"ready"}
2020-08-03 20:34:10.798 14234-14234/? W/AILive/D: >>>开始检查文件下载状态...
2020-08-03 20:34:10.817 14234-14234/? W/AILive/D: >>>视频已下载完成
2020-08-03 20:34:10.817 14234-14234/? W/AILive/D: >>>游戏状态:6003
2020-08-03 20:34:10.817 14234-14234/? W/AILive/D: >>>准备就绪,开始AI直播吧。
2020-08-03 20:34:11.823 14234-14234/? W/AILive/D: >>>播放自我介绍视频
2020-08-03 20:34:11.823 14234-14234/? W/AILive/D: playSampleVideo called with mVideoPosition = 0
2020-08-03 20:34:18.419 14234-14234/? W/AILive/D: MediaPlayer Play Complete
2020-08-03 20:34:18.465 14234-14234/? W/AILive/D: >>>分析下一步该干什么
2020-08-03 20:34:18.465 14234-14234/? W/AILive/D: >>切换游戏场景
2020-08-03 20:34:18.465 14234-14234/? W/AILive/D: >window.loadScene('ready')
2020-08-03 20:34:18.466 14234-14234/? W/AILive/D: >>播放下一个视频
2020-08-03 20:34:18.466 14234-14234/? W/AILive/D: playSampleVideo called with mVideoPosition = 1
2020-08-03 20:34:24.649 14234-14883/? W/AILive/D: >>>收到JS发来的信息:{"type":"6003","content":"game","args":"gone"}
2020-08-03 20:34:30.633 14234-14234/? W/AILive/D: MediaPlayer Play Complete
2020-08-03 20:34:30.669 14234-14234/? W/AILive/D: >>>分析下一步该干什么
2020-08-03 20:34:30.669 14234-14234/? W/AILive/D: >>切换游戏场景
2020-08-03 20:34:30.669 14234-14234/? W/AILive/D: >window.loadScene('gone')
2020-08-03 20:34:30.670 14234-14234/? W/AILive/D: >>播放下一个视频
2020-08-03 20:34:30.670 14234-14234/? W/AILive/D: playSampleVideo called with mVideoPosition = 2
2020-08-03 20:34:36.826 14234-14883/? W/AILive/D: >>>收到JS发来的信息:{"type":"6003","content":"game","args":"idol1in"}
2020-08-03 20:34:39.438 14234-14234/? W/AILive/D: MediaPlayer Play Complete
2020-08-03 20:34:39.475 14234-14234/? W/AILive/D: >>>分析下一步该干什么
2020-08-03 20:34:39.475 14234-14234/? W/AILive/D: >>切换游戏场景
2020-08-03 20:34:39.475 14234-14234/? W/AILive/D: >window.loadScene('idol1in')
2020-08-03 20:34:39.476 14234-14234/? W/AILive/D: >>播放下一个视频
2020-08-03 20:34:39.476 14234-14234/? W/AILive/D: playSampleVideo called with mVideoPosition = 3
2020-08-03 20:34:44.414 14234-14883/? W/AILive/D: >>>收到JS发来的信息:{"type":"6002","content":"It's a lion.","args":"idol1s1tmp"}
2020-08-03 20:35:17.848 14234-14234/? W/AILive/D: MediaPlayer Play Complete
2020-08-03 20:35:17.905 14234-14234/? W/AILive/D: >>>分析下一步该干什么
2020-08-03 20:35:17.906 14234-14234/? W/AILive/D: >>用户还没有触发跟读,触发跟读
2020-08-03 20:35:17.906 14234-14234/? W/AILive/D: >>>读单词或句子 --> It's a lion.
2020-08-03 20:35:17.906 14234-14234/? W/AILive/D: >>mVideoIndex = 0
2020-08-03 20:35:17.906 14234-14234/? E/AILive/D: @@@@@@ 1.重置mAIRecordInfo
2020-08-03 20:35:17.906 14234-14234/? W/AILive/D: >>启动语音评测
2020-08-03 20:35:17.906 14234-14234/? W/AILive/D: ********* 开始录像 *********
2020-08-03 20:35:17.911 14234-14234/? W/AILive/D: 视频存放路径:/storage/emulated/0/LittleBuds/Videos/VID_0_1596458117906.mp4
2020-08-03 20:35:17.912 14234-14234/? W/AILive/D: >>>playStandbyVideo() called
2020-08-03 20:35:17.968 14234-14234/? E/AILive/D: @@@@@@ 2.设置音频地址/storage/emulated/0/msc/CD5DEF9622412041A9E61B8AB1999709.wav
2020-08-03 20:35:18.180 14234-14234/? W/AILive/D: 1.1 内部录音机已经准备好了,用户可以开始语音输入
2020-08-03 20:35:18.180 14234-14234/? W/AILive/D: >>>展示跟读UI
2020-08-03 20:35:20.323 14234-14234/? W/AILive/D: MediaPlayer Play Complete
2020-08-03 20:35:20.395 14234-14234/? W/AILive/D: >>>playStandbyVideo() called
2020-08-03 20:35:21.030 14234-14234/? W/AILive/D: 1.3 检测到了语音的尾端点,已经进入识别过程,不再接受语音输入
2020-08-03 20:35:21.302 14234-14234/? W/AILive/D: 第二步:收到语音评测结果:isLast = [true]
2020-08-03 20:35:21.317 14234-14234/? W/AILive/D: 第三步:正在解析评测结果
2020-08-03 20:35:21.318 14234-14234/? W/AILive/D: resultStr = 单词:It's a lion. 得分:100[4.573915] 评级:Perfect
2020-08-03 20:35:21.318 14234-14234/? W/AILive/D: >>>playUeVideo() called with: realScore = [100]
2020-08-03 20:35:21.414 14234-14234/? W/AILive/D: @@@onStopRecording called with isLast = [true]
2020-08-03 20:35:21.414 14234-14234/? W/AILive/D: ********* 停止录像 *********
2020-08-03 20:35:21.415 14234-14234/? W/AILive/D: >>paths.size = 1
2020-08-03 20:35:21.415 14234-14234/? W/AILive/D: >>videoFileName = /storage/emulated/0/LittleBuds/Videos/VID_0_1596458117906.mp4
2020-08-03 20:35:21.415 14234-14234/? E/AILive/D: @@@@@@ 4.设置视频地址/storage/emulated/0/LittleBuds/Videos/VID_0_1596458117906.mp4
2020-08-03 20:35:21.415 14234-14234/? E/AILive/D: @@@@@@ 5.复制一份加入列表,当前列表size=1
2020-08-03 20:35:21.415 14234-14234/? W/AILive/D: >window.loadScene('idol1s1tmp')
2020-08-03 20:35:21.436 14234-14883/? W/AILive/D: >>>收到JS发来的信息:{"type":"6003","content":"It's a lion.","args":"idol1s2"}
2020-08-03 20:35:24.418 14234-14234/? W/AILive/D: >>>@@@@@@batchUploadLiveData() called with:uploadSuccessCount = 0
2020-08-03 20:35:24.418 14234-14234/? W/AILive/D: >>>@@@@@@batchUploadLiveData() called with:uploadFailedCount = 0
2020-08-03 20:35:24.419 14234-14234/? W/AILive/D: @@@上传音频:/storage/emulated/0/msc/CD5DEF9622412041A9E61B8AB1999709.wav
2020-08-03 20:35:24.458 14234-14234/? W/AILive/D: @@@上传视频:/storage/emulated/0/LittleBuds/Videos/VID_0_1596458117906.mp4
2020-08-03 20:35:24.807 14234-15812/? W/AILive/D: @音频上传成功:http://buds-dev.oss-cn-shenzhen.aliyuncs.com/user_speak/ae81019a-9eee-40d6-a40b-ad045ecba644.wav
2020-08-03 20:35:24.915 14234-15813/? W/AILive/D: @视频上传成功:http://buds-dev.oss-cn-shenzhen.aliyuncs.com/ai_live/5550476b-2022-4dd7-bedd-223feecf632b.mp4
2020-08-03 20:35:28.518 14234-14234/? W/AILive/D: MediaPlayer Play Complete
2020-08-03 20:35:28.564 14234-14234/? W/AILive/D: >>>分析下一步该干什么
2020-08-03 20:35:28.564 14234-14234/? W/AILive/D: >>切换游戏场景
2020-08-03 20:35:28.565 14234-14234/? W/AILive/D: >window.loadScene('idol1s2')
2020-08-03 20:35:28.565 14234-14234/? W/AILive/D: >>播放下一个视频
2020-08-03 20:35:28.565 14234-14234/? W/AILive/D: playSampleVideo called with mVideoPosition = 4
2020-08-03 20:35:28.640 14234-14883/? W/AILive/D: >>>收到JS发来的信息:{"type":"6002","content":"It's a lion.","args":"idol1s2tmp"}