优化
This commit is contained in:
truewhile
2026-08-25 19:18:49 +08:00
parent 6a96c5640e
commit 019ecbec7b
3 changed files with 15 additions and 0 deletions
+3
View File
@@ -128,6 +128,9 @@ export function DanmakuStage({
const loadDanmaku = async () => {
let loadedInfo: DanmakuLoadedInfo | null = null
comments = []
nextIndex = 0
manager.clear()
try {
const res = await danmakuAPI.fetch(media.id, {
kw: search ?? undefined,
+11
View File
@@ -168,6 +168,17 @@ export function PlayerPage() {
setDanmakuInfo(null)
}, [])
// 切换视频时重置媒体与弹幕状态,确保新视频自动重新识别并加载弹幕
useEffect(() => {
setMedia(null)
setDanmakuEpisodeId(null)
setDanmakuCandidates([])
setDanmakuSearch(null)
setDanmakuSelectedSource('')
setDanmakuInfo(null)
setDanmakuSearching(true)
}, [id])
// Load metadata and pick a default mode.
useEffect(() => {
if (!id) return
+1
View File
@@ -249,6 +249,7 @@ export function PlayerVideoStage({
))}
</video>
<DanmakuStage
key={media.id}
media={media}
videoRef={videoRef}
enabled={danmakuEnabled}