Commit 9164531a by lijiabin

【代码优化 11018】 perf: 获取视频原信息 和 上传视频 并行操作一起等待

parent ca4ffa88
...@@ -157,18 +157,17 @@ const startUpload = async () => { ...@@ -157,18 +157,17 @@ const startUpload = async () => {
uploadError.value = '' uploadError.value = ''
uploadProgress.value = 0 uploadProgress.value = 0
// 调用你的上传方法 // 先提案获取视频的原信息 用本地blob
const blob = URL.createObjectURL(currentFile.value)
const metadataPromise = getVideoMetadata(blob)
const { promise, cancel } = uploadFileApi(currentFile.value, { const { promise, cancel } = uploadFileApi(currentFile.value, {
onProgress: (progress) => { onProgress: (progress) => {
uploadProgress.value = progress uploadProgress.value = progress
}, },
}) })
cancelUploadController = cancel cancelUploadController = cancel
const data = await promise // 并行等待
const [data, metadata] = await Promise.all([promise, metadataPromise])
// 获取视频元数据
const metadata = await getVideoMetadata(data.filePath)
// 根据你的 API 返回结构调整 // 根据你的 API 返回结构调整
const videoData: VideoInfo = { const videoData: VideoInfo = {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment