Bilibili-Evolved/registry/lib/plugins/video/download/wasm-output/index.ts
WakelessSloth56 4979500d2c
feat: wasm-output plugin supports multiple pages
Co-authored-by: lainio24 <lainio24@outlook.com>
2024-04-26 16:36:14 +08:00

34 lines
1.0 KiB
TypeScript

import { Toast } from '@/core/toast'
import { PluginMetadata } from '@/plugins/plugin'
import { DownloadVideoOutput } from '../../../../components/video/download/types'
import { run } from './handler'
export const title = 'WASM 混流输出'
const desc = '使用 WASM 在浏览器中下载并合并音视频'
export const plugin: PluginMetadata = {
name: 'downloadVideo.outputs.wasm',
displayName: `下载视频 - ${title}`,
description: desc,
author: {
name: 'WakelessSloth56',
link: 'https://github.com/WakelessSloth56',
},
setup: ({ addData }) => {
addData('downloadVideo.outputs', (outputs: DownloadVideoOutput[]) => {
outputs.push({
name: 'wasm',
displayName: 'WASM',
description: `${desc},运行过程中请勿关闭页面,初次使用或清除缓存后需要加载约 30 MB 的 WASM 文件`,
runAction: async action => {
try {
await run(action)
} catch (error) {
Toast.error(String(error), title)
}
},
})
})
},
}