视频支持封面下载

This commit is contained in:
目棃
2024-07-12 11:14:03 +08:00
parent ea5e568525
commit 3347482164

View File

@@ -18,6 +18,10 @@ import Artplayer from "artplayer";
import type { Option } from "artplayer/types/option.js";
import { onMounted, ref, toRaw } from "vue";
import { getImageBuffer, saveCanvasImg } from "../../utils/TGShare.js";
import { bytesToSize } from "../../utils/toolFunc.js";
import showSnackbar from "../func/snackbar.js";
interface TpVod {
insert: {
vod: {
@@ -97,6 +101,19 @@ onMounted(async () => {
}</span>`,
tooltip: `播放数:${props.data.insert.vod?.view_num ?? 0}`,
},
{
name: "download-cover",
index: 0,
position: "right",
html: `<i class="mdi mdi-download"></i>`,
tooltip: "下载封面",
click: async () => {
const buffer = await getImageBuffer(props.data.insert.vod.cover);
const size = bytesToSize(buffer.byteLength);
await saveCanvasImg(buffer, `vod-cover-${props.data.insert.vod.id}`);
showSnackbar({ text: `封面已下载到本地,大小:${size}` });
},
},
],
};
container.value = new Artplayer(option);