Compare commits
	
		
			2 Commits
		
	
	
		
			03d28117cc
			...
			0dd29a1fec
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 0dd29a1fec | |||
| 23f8e37a3a | 
| @ -223,34 +223,61 @@ 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) { | ||||||
|     rtsp_server.detectVideoSnapshotSize(video_uri, fileName, (err, snapResult) => { |     // return new
 | ||||||
|       console.log("baohaowen_detectLoop round end size1:" + snapResult.fileSize); |  | ||||||
|       callback({ fileSize: snapResult.fileSize, errorCode: snapResult.errorCode }) |  | ||||||
|     }); |  | ||||||
|   } else { |  | ||||||
|     return new Promise<takePhotoParam>(async (resolve, reject) => { |     return new Promise<takePhotoParam>(async (resolve, reject) => { | ||||||
|       const time = await getCurrentTime() |       rtsp_server.detectVideoSnapshotSize(video_uri, fileName, false, (err, snapResult) => { | ||||||
|       const date = time.split(' ')[0] |         console.log("baohaowen_detectLoop round end size1:" + snapResult.fileSize, snapResult.dataString); | ||||||
|       let dirName = dir ? dir : date |         callback && callback({ | ||||||
|       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, |           fileSize: snapResult.fileSize, | ||||||
|           errorCode: snapResult.errorCode, |           errorCode: snapResult.errorCode, | ||||||
|             path: snapResult.filePath |           base64: snapResult.dataString | ||||||
|         }) |         }) | ||||||
|  |         resolve({ fileSize: snapResult.fileSize, errorCode: snapResult.errorCode, base64: snapResult.dataString }) | ||||||
|  |       }); | ||||||
|  |     }) | ||||||
|  | 
 | ||||||
|  |   } 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) => { | ||||||
|  |         if (snapResult.result && snapResult.errorCode == 0) { | ||||||
|  |           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 { | ||||||
|           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