mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-28 18:41:20 -08:00
feat: Add support for custom file names in screenshot functionality
This commit is contained in:
1 parent
b2796a1f6c
commit
caddb2091e
2 files changed
+4
-2
No files matched your search
@@ -7,6 +7,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
- 新增 `Artplayer.STYLE` 属性,返回播放器样式文本
|
- 新增 `Artplayer.STYLE` 属性,返回播放器样式文本
|
||||||
|
- `art.screenshot('your-name')` 截图功能支持自定义文件名字
|
||||||
|
|
||||||
## [5.1.6] - 2024-6-15
|
## [5.1.6] - 2024-6-15
|
||||||
|
|
||||||
|
|||||||
@@ -41,9 +41,10 @@ export default function screenshotMix(art) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
def(art, 'screenshot', {
|
def(art, 'screenshot', {
|
||||||
value: async () => {
|
value: async (name) => {
|
||||||
const dataUri = await art.getDataURL();
|
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);
|
art.emit('screenshot', dataUri);
|
||||||
return dataUri;
|
return dataUri;
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in new issue
Block a user