feat(material): remove video cover extraction and simplify upload API
- Remove extractVideoCoverOptional function and related video cover processing - Update MaterialService.uploadFile method signature to remove coverBase64 parameter - Simplify uploadAndIdentifyVideo function by removing cover generation logic - Remove loading indicator from VideoSelector component during video preview - Add presignGetUrlWithProcess method to FileClient interface for processed file URLs - Add logging support to S3FileClient implementation
This commit is contained in:
@@ -6,22 +6,6 @@ import { MaterialService } from './material'
|
||||
|
||||
// ========== 辅助函数 ==========
|
||||
|
||||
/**
|
||||
* 从视频中提取封面(可选操作)
|
||||
*/
|
||||
async function extractVideoCoverOptional(file) {
|
||||
try {
|
||||
const { extractVideoCover } = await import('@/utils/video-cover')
|
||||
const cover = await extractVideoCover(file, {
|
||||
maxWidth: 800,
|
||||
quality: 0.8
|
||||
})
|
||||
return cover.base64
|
||||
} catch {
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行人脸识别并返回结果
|
||||
*/
|
||||
@@ -103,9 +87,7 @@ export async function identifyUploadedVideo(videoFile) {
|
||||
* 上传视频并识别
|
||||
*/
|
||||
export async function uploadAndIdentifyVideo(file) {
|
||||
const coverBase64 = await extractVideoCoverOptional(file)
|
||||
|
||||
const uploadRes = await MaterialService.uploadFile(file, 'digital_human', coverBase64, null, null)
|
||||
const uploadRes = await MaterialService.uploadFile(file, 'digital_human', null, null)
|
||||
if (uploadRes.code !== 0) {
|
||||
throw new Error(uploadRes.msg || '上传失败')
|
||||
}
|
||||
|
||||
@@ -65,12 +65,11 @@ export const MaterialService = {
|
||||
* 上传文件
|
||||
* @param {File} file - 文件对象
|
||||
* @param {string} fileCategory - 文件分类(video/generate/audio/mix/voice)
|
||||
* @param {string} coverBase64 - 视频封面 base64(可选,data URI 格式)
|
||||
* @param {number} duration - 视频时长(秒,可选,自动获取)
|
||||
* @param {number} groupId - 分组编号(可选)
|
||||
* @returns {Promise}
|
||||
*/
|
||||
async uploadFile(file, fileCategory, coverBase64 = null, duration = null, groupId = null) {
|
||||
async uploadFile(file, fileCategory, duration = null, groupId = null) {
|
||||
if (duration === null && file.type.startsWith('video/')) {
|
||||
duration = await getVideoDuration(file);
|
||||
}
|
||||
@@ -83,10 +82,6 @@ export const MaterialService = {
|
||||
formData.append('duration', duration.toString());
|
||||
}
|
||||
|
||||
if (coverBase64) {
|
||||
formData.append('coverBase64', coverBase64)
|
||||
}
|
||||
|
||||
if (groupId !== null) {
|
||||
formData.append('groupId', groupId.toString())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user