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
|
||||
// var snapResult = rtsp_server.getVideoSnapshot(context, video_uri, '', dir);
|
||||
if (flag == 0) {
|
||||
// return new
|
||||
return new Promise<takePhotoParam>(async (resolve, reject) => {
|
||||
rtsp_server.detectVideoSnapshotSize(video_uri, fileName, false, (err, snapResult) => {
|
||||
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 })
|
||||
rtsp_server.detectVideoSnapshotSize(video_uri, fileName, (err, snapResult) => {
|
||||
console.log("baohaowen_detectLoop round end size1:" + snapResult.fileSize);
|
||||
callback({ fileSize: snapResult.fileSize, errorCode: snapResult.errorCode })
|
||||
});
|
||||
})
|
||||
|
||||
} else {
|
||||
return new Promise<takePhotoParam>(async (resolve, reject) => {
|
||||
// const time = await getCurrentTime()
|
||||
// const date = time.split(' ')[0]
|
||||
// let dirName = dir ? dir : date
|
||||
rtsp_server.detectVideoSnapshotSize(video_uri, fileName, true, (err, snapResult) => {
|
||||
const time = await getCurrentTime()
|
||||
const date = time.split(' ')[0]
|
||||
let dirName = dir ? dir : date
|
||||
rtsp_server.getVideoSnapshot(context, video_uri, fileName, dirName, true, async (err, snapResult) => {
|
||||
if (snapResult.result && snapResult.errorCode == 0) {
|
||||
console.log("baohaowen_detectLoop round end size1:" + snapResult.fileSize, snapResult.dataString);
|
||||
callback && callback({
|
||||
resolve({
|
||||
base64: snapResult.dataString,
|
||||
name: snapResult.fileName,
|
||||
fileSize: snapResult.fileSize,
|
||||
errorCode: snapResult.errorCode,
|
||||
base64: snapResult.dataString
|
||||
path: snapResult.filePath
|
||||
})
|
||||
resolve({ fileSize: snapResult.fileSize, errorCode: snapResult.errorCode, base64: snapResult.dataString })
|
||||
} else {
|
||||
promptAction.showToast({
|
||||
message: `拍照失败`,
|
||||
duration: 3000
|
||||
});
|
||||
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