Merge branch 'preview-fixes' of https://github.com/the1812/Bilibili-Evolved into preview-fixes

This commit is contained in:
the1812 2022-03-06 22:09:39 +08:00
commit 67887faebf

View File

@ -19,13 +19,18 @@ const entry = async () => {
order: 0, order: 0,
action: async (e: MouseEvent) => { action: async (e: MouseEvent) => {
const { playerAgent } = await import('@/components/video/player-agent') const { playerAgent } = await import('@/components/video/player-agent')
const video = await playerAgent.query.video.element() as HTMLVideoElement const video = await playerAgent.query.video.element()
const screenshot = takeScreenshot(video, e.shiftKey) if (video instanceof HTMLVideoElement) {
if (!screenShotsList) { const screenshot = takeScreenshot(video, e.shiftKey)
screenShotsList = mountVueComponent(ScreenshotContainer) if (!screenShotsList) {
document.body.insertAdjacentElement('beforeend', screenShotsList.$el) screenShotsList = mountVueComponent(ScreenshotContainer)
document.body.insertAdjacentElement('beforeend', screenShotsList.$el)
}
screenShotsList.screenshots.unshift(screenshot)
} else {
const { logError } = await import('@/core/utils/log')
logError('视频截图失败: 无法定位视频元素请尝试右击视频两次后另存为图片或将播放策略改为AV1或AVC.')
} }
screenShotsList.screenshots.unshift(screenshot)
}, },
}) })
} }