From eb2898e5c1314add59c5527b332d21de61a29463 Mon Sep 17 00:00:00 2001 From: mtvpls Date: Wed, 10 Dec 2025 21:26:03 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E7=BC=93=E5=AD=98=E7=9A=84?= =?UTF-8?q?=E5=BC=B9=E5=B9=95=E4=B8=8D=E5=8F=97=E5=BC=B9=E5=B9=95=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE=E7=9A=84=E6=8E=A7=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/play/page.tsx | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/app/play/page.tsx b/src/app/play/page.tsx index 7b568a5..850294f 100644 --- a/src/app/play/page.tsx +++ b/src/app/play/page.tsx @@ -1850,7 +1850,8 @@ function PlayPageClient() { setDanmakuLoading(true); try { - // 先清空当前弹幕 + // 先清空当前弹幕并隐藏 + danmakuPluginRef.current.hide(); danmakuPluginRef.current.config({ danmuku: [], }); @@ -1901,12 +1902,25 @@ function PlayPageClient() { } } - // 加载弹幕到插件 + // 加载弹幕到插件,同时应用当前的弹幕设置 + const currentSettings = danmakuSettingsRef.current; danmakuPluginRef.current.config({ danmuku: danmakuData, + speed: currentSettings.speed, + opacity: currentSettings.opacity, + fontSize: currentSettings.fontSize, + margin: [currentSettings.marginTop, currentSettings.marginBottom], + synchronousPlayback: currentSettings.synchronousPlayback, }); danmakuPluginRef.current.load(); + // 根据设置显示或隐藏弹幕 + if (currentSettings.enabled) { + danmakuPluginRef.current.show(); + } else { + danmakuPluginRef.current.hide(); + } + setDanmakuCount(danmakuData.length); console.log(`弹幕加载成功,共 ${danmakuData.length} 条`);