Commit 929ddc3a authored by liujiangnan's avatar liujiangnan

feat: 录屏测试

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