From deaeeb98ca0bc2a2e8fe2320e650ed1d87ff1434 Mon Sep 17 00:00:00 2001 From: Misha <54498172+Mishasama@users.noreply.github.com> Date: Wed, 22 Jan 2025 22:17:29 +0900 Subject: [PATCH] =?UTF-8?q?=E5=B0=9D=E8=AF=95=E8=A7=A3=E5=86=B3=E5=88=86?= =?UTF-8?q?=E8=BE=A8=E7=8E=87=E4=B8=8E=E7=BC=A9=E6=94=BE=E7=AE=97=E6=B3=95?= =?UTF-8?q?=E5=AF=BC=E8=87=B4=E7=9A=84=E6=A8=A1=E7=B3=8A=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 通过让视频画面的分辨率能被4整除,让大部分的缩放算法都能呈现出较为锐利的画面。 --- src/core/WebProvider/DocPIPWebProvider.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/core/WebProvider/DocPIPWebProvider.ts b/src/core/WebProvider/DocPIPWebProvider.ts index b3db9e5e..0ee274f6 100644 --- a/src/core/WebProvider/DocPIPWebProvider.ts +++ b/src/core/WebProvider/DocPIPWebProvider.ts @@ -43,6 +43,20 @@ export default class DocPIPWebProvider extends WebProvider { } } + // 调整宽高,使其能被4整除 + width = Math.floor(width / 4) * 4; + height = Math.floor(height / 4) * 4; + + // 确保宽高比不变 + const aspectRatio = vw / vh; + if (width / height > aspectRatio) { + // 如果宽高比大于原始比率,调整高度 + height = Math.floor(width / aspectRatio); + } else { + // 如果宽高比小于或等于原始比率,调整宽度 + width = Math.floor(height * aspectRatio); + } + await this.miniPlayer.init() const playerEl = this.miniPlayer.playerRootEl if (!playerEl) {