mirror of
https://github.com/the1812/Bilibili-Evolved.git
synced 2025-11-04 21:22:45 +08:00
Fix bugs
This commit is contained in:
parent
26bfcaea8e
commit
6c69cda67c
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
2
min/screenshot.min.js
vendored
2
min/screenshot.min.js
vendored
File diff suppressed because one or more lines are too long
@ -14,19 +14,21 @@ class Screenshot {
|
||||
canvas.height = this.video.videoHeight;
|
||||
const context = canvas.getContext("2d");
|
||||
if (context === null) {
|
||||
throw new Error("视频截图失败: canvas 未创建或创建失败.");
|
||||
logError("视频截图失败: canvas 未创建或创建失败.");
|
||||
return;
|
||||
}
|
||||
context.drawImage(this.video, 0, 0);
|
||||
canvas.toBlob(blob => {
|
||||
if (blob === null) {
|
||||
throw new Error("视频截图失败: 创建 blob 失败.");
|
||||
logError("视频截图失败: 创建 blob 失败.");
|
||||
return;
|
||||
}
|
||||
this.blob = blob;
|
||||
this.url = URL.createObjectURL(blob);
|
||||
}, "image/png");
|
||||
}
|
||||
get filename() {
|
||||
return `${getFriendlyTitle()} @${this.time}-${this.timeStamp.toString()}.png`;
|
||||
return `${getFriendlyTitle()} @${this.time.replace(/:/g, "-")} ${this.timeStamp.toString()}.png`;
|
||||
}
|
||||
get id() {
|
||||
return this.videoTime.toString() + this.timeStamp.toString();
|
||||
|
||||
@ -22,14 +22,16 @@ class Screenshot
|
||||
const context = canvas.getContext("2d");
|
||||
if (context === null)
|
||||
{
|
||||
throw new Error("视频截图失败: canvas 未创建或创建失败.");
|
||||
logError("视频截图失败: canvas 未创建或创建失败.");
|
||||
return;
|
||||
}
|
||||
context.drawImage(this.video, 0, 0);
|
||||
canvas.toBlob(blob =>
|
||||
{
|
||||
if (blob === null)
|
||||
{
|
||||
throw new Error("视频截图失败: 创建 blob 失败.");
|
||||
logError("视频截图失败: 创建 blob 失败.");
|
||||
return;
|
||||
}
|
||||
this.blob = blob;
|
||||
this.url = URL.createObjectURL(blob);
|
||||
@ -37,7 +39,7 @@ class Screenshot
|
||||
}
|
||||
get filename()
|
||||
{
|
||||
return `${getFriendlyTitle()} @${this.time}-${this.timeStamp.toString()}.png`;
|
||||
return `${getFriendlyTitle()} @${this.time.replace(/:/g, "-")} ${this.timeStamp.toString()}.png`;
|
||||
}
|
||||
get id()
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user