Commit 6cc1644e authored by liujiangnan's avatar liujiangnan

feat: 录音调整

parent 5268c0b4
......@@ -96,22 +96,14 @@ export function initAir(_this) {
gameEnd() {
_this.log(`===成功调用gameEnd===`);
},
startRecord(testText) {
_this.log(`===成功调用startRecord=== testText == ${testText}`);
startRecord(isSpeechToText) {
_this.log(`===成功调用startRecord=== isSpeechToText == ${isSpeechToText}`);
window.courseware.hasCalledStartRecord = true;
window.courseware.callOcMethod("startRecord", { "params": testText });
window.courseware.callOcMethod("startRecord", { isSpeechToText });
},
stopRecord(isSpeechToText, _callback) {
stopRecord(callback) {
window.courseware.hasCalledStartRecord = false;
_this.log(`===成功调用stopRecord=== isSpeechToText == ${isSpeechToText}`);
let callback = _callback;
let _isSpeechToText;
if (isSpeechToText && typeof isSpeechToText === "function") {
callback = isSpeechToText;
_isSpeechToText = 1;
} else {
_isSpeechToText = isSpeechToText;
}
_this.log(`===成功调用stopRecord===`);
if (!callback) {
// 不传回调函数就表示取消评测
window.courseware.callOcMethod("stopRecord", { isBreak: 1 });
......@@ -119,13 +111,12 @@ export function initAir(_this) {
}
// 结束录音
window.air.recordCallBack = (res) => {
callback && callback(JSON.stringify(res));
res = typeof(res) == 'string' ? res : JSON.stringify(res);
_this.log(`===成功调用recordCallBack=== res == ${res}`);
callback && callback(res);
window.air.recordCallBack = null;
};
window.courseware.callOcMethod("stopRecord", { isBreak: 0, isSpeechToText: _isSpeechToText });
window.courseware.callOcMethod("stopRecord", { isBreak: 0 });
},
startTest(testText, option) {
window.courseware.hasCalledStartTest = true;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment