Commit 93e4317c authored by 李晓兵's avatar 李晓兵

'活体检测'

parent 6fd8fc82
......@@ -10,5 +10,5 @@ module.exports = {
filePath: '"http://180.104.121.66:8088/r/api/app/fileViewSvc?sysName=XCMG_DEV&apiName=file_view&"',
ocrPath:'"http://180.104.121.66:8088/r/api"',
appId: '"com.xcmg.app"',
currentVersion: '"1.1.3"'
currentVersion: '"1.1.4"'
}
......@@ -77,12 +77,13 @@ export default {
methods: {
recordVdeo () { // 开始录制
let vm = this
vm.downNum = false // 模态框消失
let onSuccess = function (mediaFiles) {
// 遍历获取录制的文件(iOS 只支持一次录制一个视频)
/* for (let i = 0; i < mediaFiles.length; i++) {
alert('录制成功!\n\n' + '文件名:' + mediaFiles[i].name + '\n' + '大小:' + mediaFiles[i].size + '\n\n' + 'localURL地址:' + mediaFiles[i].localURL + '\n\n' + 'fullPath地址:' + mediaFiles[i].fullPath)
}*/
console.log('录制成功!\n\n' + '文件名:' + mediaFiles[0].name + '\n' + '大小:' + mediaFiles[0].size + '\n\n' + 'localURL地址:' + mediaFiles[0].localURL + '\n\n' + 'fullPath地址:' + mediaFiles[0].fullPath)
} */
console.log('录制成功!\n\n' + '文件名:' + mediaFiles[0].name + '\n' + '大小:' + mediaFiles[0].size + '\n\n' + 'localURL地址:' + mediaFiles[0].localURL + '\n\n' + 'fullPath地址:' + mediaFiles[0].fullPath)
vm.succesCall(mediaFiles[0].fullPath)
}
let onError = function (error) {
......@@ -91,80 +92,37 @@ export default {
hlsUtil.captureVideo(onSuccess, onError)
},
/* vm.videoCapture = function () {
document.addEventListener("deviceready", function () {
var options = {};
//平台判断
if (ionic.Platform.isAndroid()) {
options = {
//quality: 1, //0代表低质量压缩,1代表高质量压缩
duration: 5 * 60 * 1000, //控制视频录制长度,当到达这个长度也会停止录制,单位:毫秒
audioBitRate: -2, //视频比特率
audioChannels: 1, //声道数量
audioSampleRate: -2, //采样率
videoBitRate: -4, //音频比特率
maxFileLength: 50, //mb 录制的最大文件大小
videoFrameRate: 24, //帧数 一秒内多少个画面,画面越少越卡,但是文件大小也越小
maxQuality: "MAX_480P" //录频分辨率
};
} else if (ionic.Platform.isIOS()) {
options = {
quality: 1, //0代表低质量压缩,1代表高质量压缩
duration: 120 //控制视频录制长度,当到达这个长度也会停止录制,单位:秒
};
}
navigator.device.capture.captureVideo(onSuccess, onFail, options);
function onSuccess(mediaFiles) {
var mediaFile = mediaFiles[0];
alert("录制成功!" + ",文件名:" + mediaFile.name + ",文件大小:" + mediaFile.size +
",localURL地址:" + mediaFile.localURL + ",fullPath地址:" + mediaFile.fullPath);
if (mediaFile.size > (1024 * 1024 * 50)) {
defer.reject('录制失败,视频大小不能超过50M!');
} else {
mediaFile.desc = 'media';
//alert(mediaFile);
}
}
function onFail(message) {
alert('录制失败' + message);
}
}, false);
}; */
succesCall (fileUrl) { // 录制成功后进行检测
let vm = this
console.log('fileUrl '+ fileUrl)
console.log('sessionId '+ vm.sessionId)
console.log('fileUrl ' + fileUrl)
console.log('sessionId ' + vm.sessionId)
let url = process.env.ocrPath + '/baidu/ocr/videoFaceliveness'
let param = {
fileUrl: fileUrl,
sessionId: vm.sessionId,
}
vm.hlsPopup.showLoading('正在检测')
var flag = false
var loadInterval = setInterval(function () {
vm.hlsPopup.showLoading('视频过大,请耐心等待')
if (flag) {
vm.hlsPopup.hideLoading()
clearInterval(loadInterval)
}
}, 5000)
hlsUtil.baiduOcrVideo(param, url, function (res) {
hlsPopup.hideLoading()
flag = true
vm.hlsPopup.hideLoading()
console.log('##########res ' + JSON.stringify(res))
if (res.result.result.thresholds.frr_1e-2 < 0.9) {
vm.hlsPopup.showLongcenter('检测失败,请重新尝试')
if (res.result.result.thresholds.frr_1e - 2 < 0.9) {
vm.hlsPopup.showLongCenter('检测失败,请重新尝试')
} else {
vm.hlsPopup.showLongcenter('检测成功')
vm.hlsPopup.showLongCenter('检测成功')
}
})
/* vm.hlsHttp.post(url, param).then(function (res) {
vm.hlsPopup.hideLoading()
if (res.result.thresholds.frr_1e-2 < 0.9) {
vm.hlsPopup.showLongcenter('检测失败,请重新尝试')
} else {
vm.hlsPopup.showLongcenter('检测成功')
}
})*/
},
getCode () { // 获取验证码
//this.downNum = true
// this.downNum = true
this.computeTime()
this.time = 60
this.lastTime = 3
......@@ -180,8 +138,8 @@ export default {
vm.downNum = true
}
})
/*let str = '098672'
vm.codeList = [...str]*/
/* let str = '098672'
vm.codeList = [...str] */
},
computeTime () { // 倒计时
let vm = this
......
......@@ -552,7 +552,8 @@ export default {
}
function error (e) {
this.hlsPopup.showLongCenter('识别失败')
console.log('识别失败')
hlsPopup.showLongCenter('识别失败')
}
ft.upload(path, url, uploadSuccess, error, options)
......
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