refactor: video type

This commit is contained in:
手瓜一十雪 2024-07-23 15:51:57 +08:00
parent f916682a71
commit 451b88d7e3
3 changed files with 32 additions and 55 deletions

File diff suppressed because one or more lines are too long

View File

@ -10,7 +10,8 @@ import {
SendReplyElement,
sendShareLocationElement,
SendTextElement,
SendVideoElement
SendVideoElement,
viedo_type
} from './index';
import { promises as fs } from 'node:fs';
import ffmpeg from 'fluent-ffmpeg';
@ -127,7 +128,7 @@ export class SendMsgElementConstructor {
return element;
}
static async video(filePath: string, fileName: string = '', diyThumbPath: string = ''): Promise<SendVideoElement> {
static async video(filePath: string, fileName: string = '', diyThumbPath: string = '', videotype: viedo_type = viedo_type.VIDEO_FORMAT_MP4): Promise<SendVideoElement> {
const { fileName: _fileName, path, fileSize, md5 } = await NTQQFileApi.uploadFile(filePath, ElementType.VIDEO);
if (fileSize === 0) {
throw '文件异常大小为0';
@ -195,6 +196,7 @@ export class SendMsgElementConstructor {
thumbWidth: videoInfo.width,
thumbHeight: videoInfo.height,
fileSize: '' + fileSize,
fileFormat: videotype
// fileUuid: "",
// transferStatus: 0,
// progress: 0,

View File

@ -526,7 +526,7 @@ export interface VideoElement {
thumbMd5?: string
fileTime?: number; // second
thumbSize?: number; // byte
fileFormat?: number; // 2表示mp4 参考下面条目
fileFormat?: viedo_type; // 2表示mp4 参考下面条目
fileSize?: string; // byte
thumbWidth?: number;
thumbHeight?: number;