Commit 929ddc3a authored by liujiangnan's avatar liujiangnan

feat: 录屏测试

parent 2791d30f
......@@ -6091,8 +6091,8 @@
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_string": "开始录",
"_N$string": "开始录",
"_string": "开始录",
"_N$string": "开始录",
"_fontSize": 20,
"_lineHeight": 40,
"_enableWrapText": false,
......@@ -7204,8 +7204,8 @@
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_string": "结束录",
"_N$string": "结束录",
"_string": "结束录",
"_N$string": "结束录",
"_fontSize": 20,
"_lineHeight": 40,
"_enableWrapText": false,
......
......@@ -44,6 +44,7 @@ export function initAir(_this) {
startBuyToAppStoreCallBack: null,
recognitionCameraCallBack: null,
testCallBack: null,
recordScreenCallBack: null,
testConvertCallBack: null,
recordCallBack: null,
onCourseInScreen: null,
......@@ -222,6 +223,30 @@ export function initAir(_this) {
window.courseware.callOcMethod("stopTestConvert", {});
},
startRecordScreen(option) {
window.courseware.hasCalledStartRecordScreen = true;
_this.log(`===成功调用startRecordScreen===`);
window.courseware.callOcMethod("startRecordScreen", option);
},
stopRecordScreen(callback) {
window.courseware.hasCalledStartRecordScreen = false;
_this.log(`===成功调用stopRecordScreen===`);
if (!callback) {
// 不传回调函数就表示取消评测
_this.log(`===成功取消录屏评测===`);
window.courseware.callOcMethod("stopRecordScreen", { isBreak: 1 });
return;
}
// 结束录屏
window.air.recordScreenCallBack = (res) => {
res = typeof(res) == 'string' ? res : JSON.stringify(res);
_this.log(`===成功调用recordScreenCallBack=== res == ${res}`);
callback && callback(res);
window.air.recordScreenCallBack = null;
};
window.courseware.callOcMethod("stopRecordScreen", {});
},
startRealtimeRecord(params = {}) {
window.courseware.hasCalledRealtimeRecord = true;
_this.log(`===成功调用startRealtimeRecord===${JSON.stringify(params)}`);
......@@ -416,6 +441,8 @@ export function initAir(_this) {
window.air.recordCallBack(recordMockData);
} else if (method == 'startBuyToAppStore') {
window.air.startBuyToAppStoreCallBack({productid: 1, puid: 22, receiptData: "HelloWorld", error: ""});
} else if (method == 'stopRecordScreen') {
window.air.recordScreenCallBack({"url":"abcedfgh","error":""});
} else{
console.error(`${method}方法还没有Mock数据,请联系技术支持人员添加`);
}
......@@ -431,6 +458,9 @@ export function initAir(_this) {
if (window.courseware.hasCalledStartTestConvert) {
window.courseware.stopTestConvert();
}
if (window.courseware.hasCalledStartRecordScreen) {
window.courseware.stopRecordScreen();
}
if (window.courseware.hasCalledRealtimeRecord) {
window.courseware.stopRealtimeRecord();
}
......
......@@ -585,16 +585,15 @@ export default class NewClass extends middleLayerBase {
});
cc.find('middleLayer/ui/BtnOpenRecord').on('click', () => {
(<any>window).courseware.startRecord(0);
(<any>window).courseware.startRecordScreen(null);
});
cc.find('middleLayer/ui/BtnCloseRecord').on('click', () => {
(<any>window).courseware.stopRecord(res => {
this.log('--------录音返回结果 stopRecord ------------');
(<any>window).courseware.stopRecordScreen(res => {
this.log('--------录屏返回结果 stopRecordScreen ------------');
this.log(res)
this.log('------------------------------');
this.log(`录音的文本是${JSON.parse(res).text}`);
this.log(`录音的音频URL是${JSON.parse(res).audioUrl}`);
this.log(`录屏URL: ${JSON.parse(res).url}`);
});
});
......
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