Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[插件 - 下载视频 - WASM 混流输出] 超过 4GB 时抛出错误 #5102

Open
wants to merge 1 commit into
base: preview-features
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion registry/lib/plugins/video/download/wasm-output/handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { DownloadPackage, PackageEntry } from '@/core/download'
import { meta } from '@/core/meta'
import { getComponentSettings } from '@/core/settings'
import { Toast } from '@/core/toast'
import { formatPercent } from '@/core/utils/formatters'
import { formatFileSize, formatPercent } from '@/core/utils/formatters'
import { title as pluginTitle } from '.'
import type { Options } from '../../../../components/video/download'
import { DownloadVideoAction } from '../../../../components/video/download/types'
Expand Down Expand Up @@ -139,6 +139,10 @@ export async function run(action: DownloadVideoAction, muxWithMetadata: boolean)
throw new Error('仅支持 DASH 格式视频和音频')
}

if (video.size + audio.size > 4294967295) {
throw new Error(`仅支持合并 4GB 内的音视频(${formatFileSize(video.size + audio.size)})`)
}

await single(
video.title,
video.url,
Expand Down
2 changes: 1 addition & 1 deletion registry/lib/plugins/video/download/wasm-output/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const plugin: PluginMetadata = {
outputs.push({
name: 'wasm',
displayName: 'WASM',
description: `${desc}。运行过程中请勿关闭页面,初次使用或清除缓存后需要加载约 30 MB 的 WASM 文件。`,
description: `${desc}。运行过程中请勿关闭页面,初次使用或清除缓存后需要加载约 30 MB 的 WASM 文件。由于浏览器限制,仅支持合并 4GB 以内的音视频。`,
runAction: async (action, instance) => {
try {
await run(action, instance.muxWithMetadata)
Expand Down
Loading