拍照錄像修改
This commit is contained in:
		
							parent
							
								
									a4065dde4c
								
							
						
					
					
						commit
						77ddbc9c1f
					
				| @ -33,7 +33,7 @@ const FILE_ASSET_FETCH_COLUMNS = [photoAccessHelper.PhotoKeys.URI, | ||||
| 
 | ||||
| // const rtsp_server = record.createServer();
 | ||||
| 
 | ||||
| export async function startRecordVideo(param, td, context, dir, path?) { | ||||
| export async function startRecordVideo(param, td, context, dir, path?,index?) { | ||||
|   return new Promise(async (reslove, reject) => { | ||||
|     // const fileUtil = new FileUtil(globalThis.context)
 | ||||
|     // const date=dateFormat(new Date).split(' ')[0]
 | ||||
| @ -47,7 +47,7 @@ export async function startRecordVideo(param, td, context, dir, path?) { | ||||
|       if (!path) { | ||||
|         fileName = `movie_record${num}.mp4` | ||||
|       } else { | ||||
|         fileName = `${path}.mp4` | ||||
|         fileName = `${path}_${index||num}.mp4` | ||||
|       } | ||||
| 
 | ||||
|       // @ts-ignore
 | ||||
| @ -101,18 +101,18 @@ export async function saveStartRecordVideo(path) { | ||||
|       if (param['videoRecord'+i]) { | ||||
|         console.log('pathpath0',path) | ||||
| 
 | ||||
|         record_handle[i] = await getfilehandleCode(i, param, date, path) | ||||
|         record_handle[i] = await getfilehandleCode(i, param, date, path,i) | ||||
|       } | ||||
|     } | ||||
|     reslove(record_handle) | ||||
|   }) | ||||
| } | ||||
| 
 | ||||
| async function getfilehandleCode(td, param, dir, path) { | ||||
| async function getfilehandleCode(td, param, dir, path,index) { | ||||
|   return new Promise(async (reslove, reject) => { | ||||
|     console.log('pathpath1',path) | ||||
| 
 | ||||
|     const record_handle = await startRecordVideo(param, td, globalThis.context, dir, path) | ||||
|     const record_handle = await startRecordVideo(param, td, globalThis.context, dir, path,index) | ||||
|     // this.rocordHandleObj['rocord_handle'+td] = record_handle
 | ||||
|     reslove(record_handle) | ||||
|   }) | ||||
| @ -137,6 +137,8 @@ export async function getUserAlbumItemByDisplayName(displayName: string): Promis | ||||
|     console.log('get getUserAlbumItemByDisplayName, count: ' + JSON.stringify(fetchResult)); | ||||
|     if (fetchResult.getCount() > 0) { | ||||
|       const albums = await fetchResult.getLastObject(); | ||||
|       console.log('get getUserAlbumItemByDisplayName album111',albums.albumName) | ||||
| 
 | ||||
|       if(isSevenDaysAgo(albums.albumName)){ | ||||
|         deleteAllFileByPiC(albums.albumName,2) | ||||
|       } | ||||
|  | ||||
| @ -195,7 +195,6 @@ export default class TcpClient { | ||||
|       } | ||||
|       clearInterval(globalThis.intervaltcp) | ||||
|       globalThis.intervaltcp=setInterval(()=>{ | ||||
|         // setTimeout(async () => {
 | ||||
|           //程序断开
 | ||||
|           if (globalThis.tcpUdpError) { | ||||
|             console.log(TAG,'tcp信号丢失') | ||||
| @ -206,7 +205,6 @@ export default class TcpClient { | ||||
|             }); | ||||
|           } | ||||
|           globalThis.tcpUdpError = true; | ||||
|         // }, 2000)
 | ||||
|       },3000) | ||||
|       // callback(value.message)
 | ||||
|     }); | ||||
|  | ||||
| @ -343,10 +343,10 @@ export default class UdpClientByCenter { | ||||
| 
 | ||||
|       // this.stashFn(str)
 | ||||
|       const newArr = JSON.parse(JSON.stringify(strachArr)) | ||||
|       // this.writeLog({
 | ||||
|       //   time:dateFormat(new Date()),
 | ||||
|       //   PLC: JSON.stringify(newArr.toString()),
 | ||||
|       // })
 | ||||
|       this.writeLog({ | ||||
|         time:dateFormat(new Date()), | ||||
|         PLC: JSON.stringify(newArr.toString()), | ||||
|       }) | ||||
|       if(strachArr[83]!='4'){ | ||||
|         this.chafenFlag++ | ||||
|         if(this.chafenFlag>=15&&!globalThis.dialogOpen){ | ||||
| @ -393,10 +393,10 @@ export default class UdpClientByCenter { | ||||
|     this.testIfUdpConnetced(callback) | ||||
|   } | ||||
|   async  writeLog(param){ | ||||
|     // const fileUtil = new FileUtil(globalThis.context)
 | ||||
|     // const date=dateFormat(new Date).split(' ')[0]
 | ||||
|     // const folderPath = await fileUtil.initFolder(`/PLC/${date}`);
 | ||||
|     // fileUtil.editFile(`${folderPath}/plcLog.txt`, JSON.stringify(param)+`\n`)
 | ||||
|     const fileUtil = new FileUtil(globalThis.context) | ||||
|     const date=dateFormat(new Date).split(' ')[0] | ||||
|     const folderPath = await fileUtil.initFolder(`/PLC/${date}`); | ||||
|     fileUtil.editFile(`${folderPath}/plcLog.txt`, JSON.stringify(param)+`\n`) | ||||
| 
 | ||||
|   } | ||||
|   //获取当前UDP信号
 | ||||
|  | ||||
| @ -59,8 +59,8 @@ export default class EntryAbility extends UIAbility { | ||||
| 
 | ||||
|         const windowClass  = await windowStage.getMainWindow(); | ||||
|         globalThis.windowClass = windowClass | ||||
|         // await windowClass.setWindowLayoutFullScreen(true)
 | ||||
|         await windowClass.setWindowSystemBarEnable([]) //全屏
 | ||||
|         await windowClass.setWindowLayoutFullScreen(true) | ||||
|         // await windowClass.setWindowSystemBarEnable([]) //全屏
 | ||||
|         // await windowClass.setWindowSystemBarEnable(['navigation'])
 | ||||
| 
 | ||||
|         windowStage.loadContent('pages/Index', (err, data) => { | ||||
|  | ||||
| @ -1,4 +1,3 @@ | ||||
| // @ts-nocheck | ||||
| import common from '@ohos.app.ability.common'; | ||||
| import router from '@ohos.router'; | ||||
| import { getCarInfo, getDeviceInfo } from '../common/service/terminalService'; | ||||
| @ -12,7 +11,6 @@ import { initJudgeUdp } from '../common/utils/UdpJudge'; | ||||
| import { judgeConfig } from './judgeSDK/utils/judgeConfig'; | ||||
| import { getTCP } from '../common/utils/GlobalTcp'; | ||||
| import { getliushuiNum, setliushuiNum, takePhotoFn, delHilog } from '../common/service/indexService'; | ||||
| import { getUserAlbumItemByDisplayName } from '../common/service/videoService'; | ||||
| import abilityAccessCtrl, { Permissions } from '@ohos.abilityAccessCtrl'; | ||||
| import worker, { MessageEvents } from '@ohos.worker'; | ||||
| import promptAction from '@ohos.promptAction' | ||||
| @ -21,6 +19,7 @@ import errorMsgDialog from './compontents/errorMsgDialog' | ||||
| import { getSyncData } from '../common/service/initable'; | ||||
| import GetDistance from '../common/utils/GetDistance' | ||||
| import UIAbility from '@ohos.app.ability.UIAbility'; | ||||
| import { endRecordVideo, getUserAlbumItemByDisplayName, saveStartRecordVideo } from '../common/service/videoService'; | ||||
| 
 | ||||
| // import VoiceAnnounce from './judgeSDK/utils/voiceAnnouncements'; | ||||
| 
 | ||||
| @ -46,8 +45,6 @@ struct Index { | ||||
|   private vocObj = null; | ||||
|   private workerInstance = null; | ||||
|   private context = getContext(this) as common.UIAbilityContext; | ||||
|   private title = '' | ||||
|   private type = '2' | ||||
|   errorDialog: CustomDialogController = new CustomDialogController({ | ||||
|     builder: errorMsgDialog({ | ||||
|       title: globalThis.title, | ||||
| @ -331,6 +328,7 @@ struct Index { | ||||
|     workerInstance.postMessage(param); | ||||
|     workerInstance.onmessage = (e: MessageEvents): void => { | ||||
|       console.log("baoyihu after postMessage :", JSON.stringify(e.data)); | ||||
|       // @ts-ignore | ||||
|       let workData: WorkData = e.data; | ||||
|       if (workData.isComplete) { | ||||
|         router.pushUrl({ | ||||
| @ -379,6 +377,7 @@ struct Index { | ||||
|     console.log('globalThis.singlePlay', globalThis.singlePlay) | ||||
|     if (globalThis.singlePlay == undefined || globalThis.singlePlay == null) { | ||||
|       this.context.resourceManager.getRawFileContent("welcome.wav").then(value => { | ||||
|         console.log('tttttttt') | ||||
|         this.vocObj.playAudio({ | ||||
|           type: 1, | ||||
|           name: 'welcome.wav' | ||||
| @ -460,7 +459,7 @@ struct Index { | ||||
|       } | ||||
|     }, 1000) | ||||
|     delHilog() | ||||
|     // getUserAlbumItemByDisplayName() | ||||
|     getUserAlbumItemByDisplayName('') | ||||
|     //下载模型 | ||||
|     // await this.getModel() | ||||
|     // const arr = [0x55, 0xaa, 0x01, 0x00, 0x02, 0x01, 0x03, 0x00] | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user