不落盘拍照
This commit is contained in:
		
							parent
							
								
									a567923ebc
								
							
						
					
					
						commit
						4fd20c9d92
					
				| @ -168,7 +168,7 @@ export async function takePhoto( | ||||
| 
 | ||||
|   if (flag === 0) { | ||||
|     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) { | ||||
|           const result: takePhotoParam = { | ||||
|             fileSize: snapResult.fileSize, | ||||
| @ -197,35 +197,31 @@ export async function takePhoto( | ||||
|       const time = GetCurrentTime(); | ||||
|       const date = time.split(' ')[0]; | ||||
|       const dirName = dir || date; | ||||
| 
 | ||||
|       rtsp_server.getVideoSnapshot( | ||||
|         context, | ||||
|         video_uri, | ||||
|         fileName, | ||||
|         dirName, | ||||
|         true, | ||||
|         (err: BusinessError, snapResult: record.RtspResult) => { | ||||
|           if (snapResult && snapResult.errorCode === 0) { | ||||
|             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, | ||||
|             }); | ||||
|       rtsp_server.detectVideoSnapshotSize(video_uri, fileName, true,(err: BusinessError, snapResult: record.RtspResult) => { | ||||
|         if (snapResult && snapResult.errorCode === 0) { | ||||
|           const result: takePhotoParam = { | ||||
|             fileSize: snapResult.fileSize, | ||||
|             errorCode: snapResult.errorCode, | ||||
|             base64: snapResult.dataString, | ||||
|           }; | ||||
|           if (callback) { | ||||
|             callback(result); | ||||
|           } | ||||
|           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