feat: Add support for custom file names in screenshot functionality

This commit is contained in:
Harvey Zack committed 2024-07-03 15:56:49 +08:00
1 parent b2796a1f6c
commit caddb2091e
2 files changed
+4 -2

No files matched your search

@@ -41,9 +41,10 @@ export default function screenshotMix(art) {
});
def(art, 'screenshot', {
value: async () => {
value: async (name) => {
const dataUri = await art.getDataURL();
download(dataUri, `artplayer_${secondToTime($video.currentTime)}.png`);
const fileName = name || `artplayer_${secondToTime($video.currentTime)}`;
download(dataUri, `${fileName}.png`);
art.emit('screenshot', dataUri);
return dataUri;
},