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