mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2024-11-21 09:36:35 +00:00
refactor: video type
This commit is contained in:
parent
f916682a71
commit
451b88d7e3
File diff suppressed because one or more lines are too long
@ -10,7 +10,8 @@ import {
|
|||||||
SendReplyElement,
|
SendReplyElement,
|
||||||
sendShareLocationElement,
|
sendShareLocationElement,
|
||||||
SendTextElement,
|
SendTextElement,
|
||||||
SendVideoElement
|
SendVideoElement,
|
||||||
|
viedo_type
|
||||||
} from './index';
|
} from './index';
|
||||||
import { promises as fs } from 'node:fs';
|
import { promises as fs } from 'node:fs';
|
||||||
import ffmpeg from 'fluent-ffmpeg';
|
import ffmpeg from 'fluent-ffmpeg';
|
||||||
@ -127,7 +128,7 @@ export class SendMsgElementConstructor {
|
|||||||
return element;
|
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);
|
const { fileName: _fileName, path, fileSize, md5 } = await NTQQFileApi.uploadFile(filePath, ElementType.VIDEO);
|
||||||
if (fileSize === 0) {
|
if (fileSize === 0) {
|
||||||
throw '文件异常,大小为0';
|
throw '文件异常,大小为0';
|
||||||
@ -195,6 +196,7 @@ export class SendMsgElementConstructor {
|
|||||||
thumbWidth: videoInfo.width,
|
thumbWidth: videoInfo.width,
|
||||||
thumbHeight: videoInfo.height,
|
thumbHeight: videoInfo.height,
|
||||||
fileSize: '' + fileSize,
|
fileSize: '' + fileSize,
|
||||||
|
fileFormat: videotype
|
||||||
// fileUuid: "",
|
// fileUuid: "",
|
||||||
// transferStatus: 0,
|
// transferStatus: 0,
|
||||||
// progress: 0,
|
// progress: 0,
|
||||||
|
@ -526,7 +526,7 @@ export interface VideoElement {
|
|||||||
thumbMd5?: string
|
thumbMd5?: string
|
||||||
fileTime?: number; // second
|
fileTime?: number; // second
|
||||||
thumbSize?: number; // byte
|
thumbSize?: number; // byte
|
||||||
fileFormat?: number; // 2表示mp4 参考下面条目
|
fileFormat?: viedo_type; // 2表示mp4 参考下面条目
|
||||||
fileSize?: string; // byte
|
fileSize?: string; // byte
|
||||||
thumbWidth?: number;
|
thumbWidth?: number;
|
||||||
thumbHeight?: number;
|
thumbHeight?: number;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user