mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-28 02:01:20 -08:00
简化工具函数
This commit is contained in:
1 parent
be4d1d0437
commit
1270167a3e
26 files changed
+182
-152
No files matched your search
@@ -1,4 +1,4 @@
|
||||
import { secondToTime, downloadFile } from '../utils';
|
||||
import { secondToTime, downloadFile, def } from '../utils';
|
||||
|
||||
export default function screenshotMix(art, player) {
|
||||
const {
|
||||
@@ -7,7 +7,7 @@ export default function screenshotMix(art, player) {
|
||||
template: { $video },
|
||||
} = art;
|
||||
|
||||
Object.defineProperty(player, 'getScreenshotDataURL', {
|
||||
def(player, 'getScreenshotDataURL', {
|
||||
value: () => {
|
||||
try {
|
||||
const canvas = document.createElement('canvas');
|
||||
@@ -22,7 +22,7 @@ export default function screenshotMix(art, player) {
|
||||
},
|
||||
});
|
||||
|
||||
Object.defineProperty(player, 'getScreenshotBlobUrl', {
|
||||
def(player, 'getScreenshotBlobUrl', {
|
||||
value: () =>
|
||||
new Promise((resolve, reject) => {
|
||||
try {
|
||||
@@ -40,7 +40,7 @@ export default function screenshotMix(art, player) {
|
||||
}),
|
||||
});
|
||||
|
||||
Object.defineProperty(player, 'screenshot', {
|
||||
def(player, 'screenshot', {
|
||||
value: () => {
|
||||
const dataUri = player.getScreenshotDataURL();
|
||||
if (dataUri) {
|
||||
|
||||
Reference in new issue
Block a user