feat:屏蔽新的诚迈录屏api
This commit is contained in:
parent
64196f4edd
commit
ef3a73f801
@ -12,7 +12,7 @@ import { FileHelper } from './FileHelper';
|
||||
import FileUtil from '../utils/File';
|
||||
import { GlobalConfig } from '../../config';
|
||||
|
||||
const rtsp_server = record.createServer();
|
||||
// const rtsp_server = record.createServer();
|
||||
//开始录屏
|
||||
const FILE_ASSET_FETCH_COLUMNS = [photoAccessHelper.PhotoKeys.URI,
|
||||
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}`);
|
||||
var video_uri = `rtsp://${param.userName}:${param.pwd}@${param.ip}:${param.port}/h264/ch${td}/main/av_stream`;
|
||||
if (rtsp_server != null) {
|
||||
console.log(`Rtsprecord startRecordVideo begin,video_uri`, video_uri);
|
||||
const num = Math.floor(Math.random() * 10000)
|
||||
let fileName
|
||||
if (!path) {
|
||||
fileName = `movie_record${num}.mp4`
|
||||
} else {
|
||||
fileName = `${path}_${index||num}.mp4`
|
||||
}
|
||||
|
||||
// @ts-ignore
|
||||
var recordResult = rtsp_server.startRecordVideo(context, video_uri, fileName, dir);
|
||||
const handleId = recordResult.dataInt;
|
||||
reslove(handleId)
|
||||
}
|
||||
else {
|
||||
console.log(`Rtsprecord startRecordVideo rtsp_server isnull`);
|
||||
reslove(0)
|
||||
}
|
||||
// if (rtsp_server != null) {
|
||||
// console.log(`Rtsprecord startRecordVideo begin,video_uri`, video_uri);
|
||||
// const num = Math.floor(Math.random() * 10000)
|
||||
// let fileName
|
||||
// if (!path) {
|
||||
// fileName = `movie_record${num}.mp4`
|
||||
// } else {
|
||||
// fileName = `${path}_${index||num}.mp4`
|
||||
// }
|
||||
//
|
||||
// // @ts-ignore
|
||||
// var recordResult = rtsp_server.startRecordVideo(context, video_uri, fileName, dir);
|
||||
// const handleId = recordResult.dataInt;
|
||||
// reslove(handleId)
|
||||
// }
|
||||
// else {
|
||||
// console.log(`Rtsprecord startRecordVideo rtsp_server isnull`);
|
||||
// reslove(0)
|
||||
// }
|
||||
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) {
|
||||
for (let key in record_handleObj) {
|
||||
if (rtsp_server != null && record_handleObj[key] > 0) {
|
||||
console.log(`Rtsprecord endRecordVideo begin`);
|
||||
// @ts-ignore
|
||||
var recordResult = rtsp_server.endRecordVideo(record_handleObj[key]);
|
||||
console.log(`Rtsprecord endRecordVideo record_handle` + record_handleObj[key].dataInt + ` filename:` + record_handleObj[key].fileName);
|
||||
|
||||
}
|
||||
else {
|
||||
console.log(`Rtsprecord endRecordVideo handleId isnull`);
|
||||
}
|
||||
// if (rtsp_server != null && record_handleObj[key] > 0) {
|
||||
// console.log(`Rtsprecord endRecordVideo begin`);
|
||||
// // @ts-ignore
|
||||
// var recordResult = rtsp_server.endRecordVideo(record_handleObj[key]);
|
||||
// console.log(`Rtsprecord endRecordVideo record_handle` + record_handleObj[key].dataInt + ` filename:` + record_handleObj[key].fileName);
|
||||
//
|
||||
// }
|
||||
// else {
|
||||
// console.log(`Rtsprecord endRecordVideo handleId isnull`);
|
||||
// }
|
||||
}
|
||||
|
||||
}
|
||||
@ -191,25 +191,25 @@ export async function takePhoto(param, context, dir, flag = 1, callback?) {
|
||||
// @ts-ignore
|
||||
// var snapResult = rtsp_server.getVideoSnapshot(context, video_uri, '', dir);
|
||||
if (flag == 0) {
|
||||
rtsp_server.detectVideoSnapshotSize(video_uri, fileName, (err, snapResult) => {
|
||||
console.log("baohaowen_detectLoop round end size1:" + snapResult.fileSize);
|
||||
callback({ fileSize: snapResult.fileSize, errorCode: snapResult.errorCode })
|
||||
});
|
||||
// rtsp_server.detectVideoSnapshotSize(video_uri, fileName, (err, snapResult) => {
|
||||
// console.log("baohaowen_detectLoop round end size1:" + snapResult.fileSize);
|
||||
// callback({ fileSize: snapResult.fileSize, errorCode: snapResult.errorCode })
|
||||
// });
|
||||
|
||||
}
|
||||
else {
|
||||
console.log('baoyihubaoyihu1', video_uri, flag)
|
||||
return new Promise<takePhotoParam>((resolve, reject) => {
|
||||
rtsp_server.getVideoSnapshot(context, video_uri, fileName, dir, true, (err, snapResult) => {
|
||||
console.log('baoyihubaoyihu', video_uri, flag, JSON.stringify(snapResult))
|
||||
console.log('getPhtot', JSON.stringify(snapResult))
|
||||
resolve({
|
||||
base64: snapResult.dataString,
|
||||
name: snapResult.fileName,
|
||||
fileSize: snapResult.fileSize,
|
||||
errorCode: snapResult.errorCode
|
||||
})
|
||||
});
|
||||
// rtsp_server.getVideoSnapshot(context, video_uri, fileName, dir, true, (err, snapResult) => {
|
||||
// console.log('baoyihubaoyihu', video_uri, flag, JSON.stringify(snapResult))
|
||||
// console.log('getPhtot', JSON.stringify(snapResult))
|
||||
// resolve({
|
||||
// base64: snapResult.dataString,
|
||||
// name: snapResult.fileName,
|
||||
// fileSize: snapResult.fileSize,
|
||||
// errorCode: snapResult.errorCode
|
||||
// })
|
||||
// });
|
||||
})
|
||||
console.log('getmyLog02')
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user