不落盘拍照
This commit is contained in:
parent
a567923ebc
commit
4fd20c9d92
@ -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,35 +197,31 @@ 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(
|
if (snapResult && snapResult.errorCode === 0) {
|
||||||
context,
|
const result: takePhotoParam = {
|
||||||
video_uri,
|
fileSize: snapResult.fileSize,
|
||||||
fileName,
|
errorCode: snapResult.errorCode,
|
||||||
dirName,
|
base64: snapResult.dataString,
|
||||||
true,
|
};
|
||||||
(err: BusinessError, snapResult: record.RtspResult) => {
|
if (callback) {
|
||||||
if (snapResult && snapResult.errorCode === 0) {
|
callback(result);
|
||||||
resolve({
|
|
||||||
base64: snapResult.dataString,
|
|
||||||
name: snapResult.fileName,
|
|
||||||
fileSize: snapResult.fileSize,
|
|
||||||
errorCode: snapResult.errorCode,
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
promptAction.showToast({
|
|
||||||
message: `拍照失败`,
|
|
||||||
duration: 3000,
|
|
||||||
});
|
|
||||||
reject({
|
|
||||||
name: fileName,
|
|
||||||
base64: '',
|
|
||||||
fileSize: 0,
|
|
||||||
errorCode: err ? err.code : -1,
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
resolve(result);
|
||||||
|
} else {
|
||||||
|
promptAction.showToast({
|
||||||
|
message: `拍照失败`,
|
||||||
|
duration: 3000,
|
||||||
|
});
|
||||||
|
reject({
|
||||||
|
name: fileName,
|
||||||
|
base64: '',
|
||||||
|
fileSize: 0,
|
||||||
|
errorCode: err ? err.code : -1,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
);
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user