feat:屏蔽新的诚迈录屏api

This commit is contained in:
Surenjun 2024-10-15 16:57:25 +08:00
parent 64196f4edd
commit ef3a73f801

View File

@ -12,7 +12,7 @@ import { FileHelper } from './FileHelper';
import FileUtil from '../utils/File'; import FileUtil from '../utils/File';
import { GlobalConfig } from '../../config'; import { GlobalConfig } from '../../config';
const rtsp_server = record.createServer(); // const rtsp_server = record.createServer();
//开始录屏 //开始录屏
const FILE_ASSET_FETCH_COLUMNS = [photoAccessHelper.PhotoKeys.URI, const FILE_ASSET_FETCH_COLUMNS = [photoAccessHelper.PhotoKeys.URI,
photoAccessHelper.PhotoKeys.PHOTO_TYPE, photoAccessHelper.PhotoKeys.PHOTO_TYPE,
@ -40,25 +40,25 @@ export async function startRecordVideo(param, td, context, dir, path?,index?) {
// const folderPath = await fileUtil.initFolder(`/PLC/${date}/${dir}`); // const folderPath = await fileUtil.initFolder(`/PLC/${date}/${dir}`);
var video_uri = `rtsp://${param.userName}:${param.pwd}@${param.ip}:${param.port}/h264/ch${td}/main/av_stream`; var video_uri = `rtsp://${param.userName}:${param.pwd}@${param.ip}:${param.port}/h264/ch${td}/main/av_stream`;
if (rtsp_server != null) { // if (rtsp_server != null) {
console.log(`Rtsprecord startRecordVideo begin,video_uri`, video_uri); // console.log(`Rtsprecord startRecordVideo begin,video_uri`, video_uri);
const num = Math.floor(Math.random() * 10000) // const num = Math.floor(Math.random() * 10000)
let fileName // let fileName
if (!path) { // if (!path) {
fileName = `movie_record${num}.mp4` // fileName = `movie_record${num}.mp4`
} else { // } else {
fileName = `${path}_${index||num}.mp4` // fileName = `${path}_${index||num}.mp4`
} // }
//
// @ts-ignore // // @ts-ignore
var recordResult = rtsp_server.startRecordVideo(context, video_uri, fileName, dir); // var recordResult = rtsp_server.startRecordVideo(context, video_uri, fileName, dir);
const handleId = recordResult.dataInt; // const handleId = recordResult.dataInt;
reslove(handleId) // reslove(handleId)
} // }
else { // else {
console.log(`Rtsprecord startRecordVideo rtsp_server isnull`); // console.log(`Rtsprecord startRecordVideo rtsp_server isnull`);
reslove(0) // reslove(0)
} // }
console.log(`Rtsprecord startRecordVideo end`); console.log(`Rtsprecord startRecordVideo end`);
}) })
@ -67,16 +67,16 @@ export async function startRecordVideo(param, td, context, dir, path?,index?) {
//结束录屏 //结束录屏
export async function endRecordVideo(record_handleObj) { export async function endRecordVideo(record_handleObj) {
for (let key in record_handleObj) { for (let key in record_handleObj) {
if (rtsp_server != null && record_handleObj[key] > 0) { // if (rtsp_server != null && record_handleObj[key] > 0) {
console.log(`Rtsprecord endRecordVideo begin`); // console.log(`Rtsprecord endRecordVideo begin`);
// @ts-ignore // // @ts-ignore
var recordResult = rtsp_server.endRecordVideo(record_handleObj[key]); // var recordResult = rtsp_server.endRecordVideo(record_handleObj[key]);
console.log(`Rtsprecord endRecordVideo record_handle` + record_handleObj[key].dataInt + ` filename:` + record_handleObj[key].fileName); // console.log(`Rtsprecord endRecordVideo record_handle` + record_handleObj[key].dataInt + ` filename:` + record_handleObj[key].fileName);
//
} // }
else { // else {
console.log(`Rtsprecord endRecordVideo handleId isnull`); // console.log(`Rtsprecord endRecordVideo handleId isnull`);
} // }
} }
} }
@ -191,25 +191,25 @@ 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) => { // rtsp_server.detectVideoSnapshotSize(video_uri, fileName, (err, snapResult) => {
console.log("baohaowen_detectLoop round end size1:" + snapResult.fileSize); // console.log("baohaowen_detectLoop round end size1:" + snapResult.fileSize);
callback({ fileSize: snapResult.fileSize, errorCode: snapResult.errorCode }) // callback({ fileSize: snapResult.fileSize, errorCode: snapResult.errorCode })
}); // });
} }
else { else {
console.log('baoyihubaoyihu1', video_uri, flag) console.log('baoyihubaoyihu1', video_uri, flag)
return new Promise<takePhotoParam>((resolve, reject) => { return new Promise<takePhotoParam>((resolve, reject) => {
rtsp_server.getVideoSnapshot(context, video_uri, fileName, dir, true, (err, snapResult) => { // rtsp_server.getVideoSnapshot(context, video_uri, fileName, dir, true, (err, snapResult) => {
console.log('baoyihubaoyihu', video_uri, flag, JSON.stringify(snapResult)) // console.log('baoyihubaoyihu', video_uri, flag, JSON.stringify(snapResult))
console.log('getPhtot', JSON.stringify(snapResult)) // console.log('getPhtot', JSON.stringify(snapResult))
resolve({ // resolve({
base64: snapResult.dataString, // base64: snapResult.dataString,
name: snapResult.fileName, // name: snapResult.fileName,
fileSize: snapResult.fileSize, // fileSize: snapResult.fileSize,
errorCode: snapResult.errorCode // errorCode: snapResult.errorCode
}) // })
}); // });
}) })
console.log('getmyLog02') console.log('getmyLog02')