mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-22 13:21:20 -08:00
修复预览图工具bug
This commit is contained in:
1 parent
465fb64cda
commit
39301b2e14
4 files changed
+37
-70
No files matched your search
@@ -108,20 +108,23 @@ class ArtplayerToolThumbnail extends Emitter {
|
||||
this.emit('canvas', canvas);
|
||||
const promiseList = screenshotDate.map((item, index) => () => {
|
||||
this.video.currentTime = item.time;
|
||||
return sleep(delay)
|
||||
.then(() => {
|
||||
context2D.drawImage(this.video, item.x, item.y, width, height);
|
||||
canvas.toBlob(blob => {
|
||||
if (this.thumbnailUrl) {
|
||||
URL.revokeObjectURL(this.thumbnailUrl);
|
||||
}
|
||||
this.thumbnailUrl = URL.createObjectURL(blob);
|
||||
this.emit('update', this.thumbnailUrl, (index + 1) / number);
|
||||
return new Promise(resolve => {
|
||||
sleep(delay)
|
||||
.then(() => {
|
||||
context2D.drawImage(this.video, item.x, item.y, width, height);
|
||||
canvas.toBlob(blob => {
|
||||
if (this.thumbnailUrl) {
|
||||
URL.revokeObjectURL(this.thumbnailUrl);
|
||||
}
|
||||
this.thumbnailUrl = URL.createObjectURL(blob);
|
||||
this.emit('update', this.thumbnailUrl, (index + 1) / number);
|
||||
resolve();
|
||||
});
|
||||
})
|
||||
.catch(err => {
|
||||
console.error(err);
|
||||
});
|
||||
})
|
||||
.catch(err => {
|
||||
console.error(err);
|
||||
});
|
||||
});
|
||||
});
|
||||
this.processing = true;
|
||||
return runPromisesInSeries(promiseList)
|
||||
|
||||
Reference in new issue
Block a user