fix: 视频优化

This commit is contained in:
wangzhongjie 2025-06-09 16:21:42 +08:00
parent 796c4c4171
commit 5efb9cd735
2 changed files with 8 additions and 7 deletions

View File

@ -42,7 +42,7 @@ struct VideoConfigPage {
rocord_handle4: 0
}
// 文件操作
private fileUtil: FileUtils
private fileUtil!: FileUtils
private context = getContext(this) as common.UIAbilityContext;
// 视频控制器
private controller1: VideoController = new VideoController()
@ -94,7 +94,8 @@ struct VideoConfigPage {
direction: FlexDirection.Column
}) {
HeaderComponent({
shortLogo: false
shortLogo: true,
shouBackArea: true
})
Flex() {
// 左边视频监控区域

View File

@ -34,8 +34,8 @@ const FILE_ASSET_FETCH_COLUMNS = [
export async function startRecordVideo(param: VideoConfig, td: number, context: common.UIAbilityContext, dir: string,
path?: string,
index?: number): Promise<number> {
path?: string,
index?: number): Promise<number> {
return new Promise(async (resolve, reject) => {
let video_uri = `rtsp://${param.userName}:${param.pwd}@${param.ip}:${param.port}/h264/ch${td}/main/av_stream`;
if (rtsp_server != null) {
@ -168,7 +168,7 @@ export async function takePhoto(
if (flag === 0) {
return new Promise<takePhotoParam>((resolve, reject) => {
rtsp_server.detectVideoSnapshotSize(video_uri, fileName, false,(err: BusinessError, snapResult: record.RtspResult) => {
rtsp_server.detectVideoSnapshotSize(video_uri, fileName, false, (err: BusinessError, snapResult: record.RtspResult) => {
if (snapResult && snapResult.errorCode === 0) {
const result: takePhotoParam = {
fileSize: snapResult.fileSize,
@ -197,7 +197,7 @@ export async function takePhoto(
const time = GetCurrentTime();
const date = time.split(' ')[0];
const dirName = dir || date;
rtsp_server.detectVideoSnapshotSize(video_uri, fileName, true,(err: BusinessError, snapResult: record.RtspResult) => {
rtsp_server.getVideoSnapshot(context, video_uri, fileName, dirName, true, (err: BusinessError, snapResult: record.RtspResult) => {
if (snapResult && snapResult.errorCode === 0) {
const result: takePhotoParam = {
fileSize: snapResult.fileSize,
@ -234,7 +234,7 @@ export async function deleteAllFileByPiC(dirName: string, type = 1, context: com
}
export async function deleteAllVideos(context: common.UIAbilityContext, type: photoAccessHelper.AlbumType,
subType: photoAccessHelper.AlbumSubtype): Promise<void> {
subType: photoAccessHelper.AlbumSubtype): Promise<void> {
let fetchResult: photoAccessHelper.FetchResult<photoAccessHelper.Album> | null = null;
let count = 0;
try {