This commit is contained in:
wangzhongjie 2025-05-09 09:52:40 +08:00
commit 13ff19aefe

View File

@ -168,7 +168,7 @@ export async function takePhoto(
if (flag === 0) { if (flag === 0) {
return new Promise<takePhotoParam>((resolve, reject) => { return new Promise<takePhotoParam>((resolve, reject) => {
rtsp_server.detectVideoSnapshotSize(video_uri, fileName, (err: BusinessError, snapResult: record.RtspResult) => { rtsp_server.detectVideoSnapshotSize(video_uri, fileName, false,(err: BusinessError, snapResult: record.RtspResult) => {
if (snapResult && snapResult.errorCode === 0) { if (snapResult && snapResult.errorCode === 0) {
const result: takePhotoParam = { const result: takePhotoParam = {
fileSize: snapResult.fileSize, fileSize: snapResult.fileSize,
@ -197,21 +197,17 @@ export async function takePhoto(
const time = GetCurrentTime(); const time = GetCurrentTime();
const date = time.split(' ')[0]; const date = time.split(' ')[0];
const dirName = dir || date; const dirName = dir || date;
rtsp_server.detectVideoSnapshotSize(video_uri, fileName, true,(err: BusinessError, snapResult: record.RtspResult) => {
rtsp_server.getVideoSnapshot(
context,
video_uri,
fileName,
dirName,
true,
(err: BusinessError, snapResult: record.RtspResult) => {
if (snapResult && snapResult.errorCode === 0) { if (snapResult && snapResult.errorCode === 0) {
resolve({ const result: takePhotoParam = {
base64: snapResult.dataString,
name: snapResult.fileName,
fileSize: snapResult.fileSize, fileSize: snapResult.fileSize,
errorCode: snapResult.errorCode, errorCode: snapResult.errorCode,
}); base64: snapResult.dataString,
};
if (callback) {
callback(result);
}
resolve(result);
} else { } else {
promptAction.showToast({ promptAction.showToast({
message: `拍照失败`, message: `拍照失败`,
@ -224,8 +220,8 @@ export async function takePhoto(
errorCode: err ? err.code : -1, errorCode: err ? err.code : -1,
}); });
} }
} });
);
}); });
} }
} }