修正缓存的弹幕不受弹幕设置的控制
This commit is contained in:
+16
-2
@@ -1850,7 +1850,8 @@ function PlayPageClient() {
|
|||||||
setDanmakuLoading(true);
|
setDanmakuLoading(true);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// 先清空当前弹幕
|
// 先清空当前弹幕并隐藏
|
||||||
|
danmakuPluginRef.current.hide();
|
||||||
danmakuPluginRef.current.config({
|
danmakuPluginRef.current.config({
|
||||||
danmuku: [],
|
danmuku: [],
|
||||||
});
|
});
|
||||||
@@ -1901,12 +1902,25 @@ function PlayPageClient() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 加载弹幕到插件
|
// 加载弹幕到插件,同时应用当前的弹幕设置
|
||||||
|
const currentSettings = danmakuSettingsRef.current;
|
||||||
danmakuPluginRef.current.config({
|
danmakuPluginRef.current.config({
|
||||||
danmuku: danmakuData,
|
danmuku: danmakuData,
|
||||||
|
speed: currentSettings.speed,
|
||||||
|
opacity: currentSettings.opacity,
|
||||||
|
fontSize: currentSettings.fontSize,
|
||||||
|
margin: [currentSettings.marginTop, currentSettings.marginBottom],
|
||||||
|
synchronousPlayback: currentSettings.synchronousPlayback,
|
||||||
});
|
});
|
||||||
danmakuPluginRef.current.load();
|
danmakuPluginRef.current.load();
|
||||||
|
|
||||||
|
// 根据设置显示或隐藏弹幕
|
||||||
|
if (currentSettings.enabled) {
|
||||||
|
danmakuPluginRef.current.show();
|
||||||
|
} else {
|
||||||
|
danmakuPluginRef.current.hide();
|
||||||
|
}
|
||||||
|
|
||||||
setDanmakuCount(danmakuData.length);
|
setDanmakuCount(danmakuData.length);
|
||||||
console.log(`弹幕加载成功,共 ${danmakuData.length} 条`);
|
console.log(`弹幕加载成功,共 ${danmakuData.length} 条`);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user