Compare commits
No commits in common. "0dd29a1fec55f5ce60bfd315db2c4448fc59e822" and "03d28117cc2c713b668d231013e33f597d6e4e2e" have entirely different histories.
0dd29a1fec
...
03d28117cc
@ -223,61 +223,34 @@ export async function takePhoto(param, context, dir, flag = 1, callback?) {
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
// var snapResult = rtsp_server.getVideoSnapshot(context, video_uri, '', dir);
|
// var snapResult = rtsp_server.getVideoSnapshot(context, video_uri, '', dir);
|
||||||
if (flag == 0) {
|
if (flag == 0) {
|
||||||
// return new
|
rtsp_server.detectVideoSnapshotSize(video_uri, fileName, (err, snapResult) => {
|
||||||
return new Promise<takePhotoParam>(async (resolve, reject) => {
|
console.log("baohaowen_detectLoop round end size1:" + snapResult.fileSize);
|
||||||
rtsp_server.detectVideoSnapshotSize(video_uri, fileName, false, (err, snapResult) => {
|
callback({ fileSize: snapResult.fileSize, errorCode: snapResult.errorCode })
|
||||||
console.log("baohaowen_detectLoop round end size1:" + snapResult.fileSize, snapResult.dataString);
|
|
||||||
callback && callback({
|
|
||||||
fileSize: snapResult.fileSize,
|
|
||||||
errorCode: snapResult.errorCode,
|
|
||||||
base64: snapResult.dataString
|
|
||||||
})
|
|
||||||
resolve({ fileSize: snapResult.fileSize, errorCode: snapResult.errorCode, base64: snapResult.dataString })
|
|
||||||
});
|
});
|
||||||
})
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
return new Promise<takePhotoParam>(async (resolve, reject) => {
|
return new Promise<takePhotoParam>(async (resolve, reject) => {
|
||||||
// const time = await getCurrentTime()
|
const time = await getCurrentTime()
|
||||||
// const date = time.split(' ')[0]
|
const date = time.split(' ')[0]
|
||||||
// let dirName = dir ? dir : date
|
let dirName = dir ? dir : date
|
||||||
rtsp_server.detectVideoSnapshotSize(video_uri, fileName, true, (err, snapResult) => {
|
rtsp_server.getVideoSnapshot(context, video_uri, fileName, dirName, true, async (err, snapResult) => {
|
||||||
if (snapResult.result && snapResult.errorCode == 0) {
|
if (snapResult.result && snapResult.errorCode == 0) {
|
||||||
console.log("baohaowen_detectLoop round end size1:" + snapResult.fileSize, snapResult.dataString);
|
resolve({
|
||||||
callback && callback({
|
base64: snapResult.dataString,
|
||||||
|
name: snapResult.fileName,
|
||||||
fileSize: snapResult.fileSize,
|
fileSize: snapResult.fileSize,
|
||||||
errorCode: snapResult.errorCode,
|
errorCode: snapResult.errorCode,
|
||||||
base64: snapResult.dataString
|
path: snapResult.filePath
|
||||||
})
|
})
|
||||||
resolve({ fileSize: snapResult.fileSize, errorCode: snapResult.errorCode, base64: snapResult.dataString })
|
|
||||||
} else {
|
} else {
|
||||||
promptAction.showToast({
|
promptAction.showToast({
|
||||||
message: `拍照失败`,
|
message: `拍照失败`,
|
||||||
duration: 3000
|
duration: 3000
|
||||||
});
|
});
|
||||||
reject(false)
|
reject(false)
|
||||||
|
// reject()
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
// rtsp_server.getVideoSnapshot(context, video_uri, fileName, dirName, true, async (err, snapResult) => {
|
|
||||||
// if (snapResult.result && snapResult.errorCode == 0) {
|
|
||||||
// resolve({
|
|
||||||
// base64: snapResult.dataString,
|
|
||||||
// name: snapResult.fileName,
|
|
||||||
// fileSize: snapResult.fileSize,
|
|
||||||
// errorCode: snapResult.errorCode,
|
|
||||||
// path: snapResult.filePath
|
|
||||||
// })
|
|
||||||
// } else {
|
|
||||||
// promptAction.showToast({
|
|
||||||
// message: `拍照失败`,
|
|
||||||
// duration: 3000
|
|
||||||
// });
|
|
||||||
// reject(false)
|
|
||||||
// // reject()
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// });
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user