fix: 移除 audio.onpause 事件监听,避免旧音频暂停时竞争刷新 playingId 状态
This commit is contained in:
@@ -520,10 +520,10 @@ export default function VoiceMaterialLibrary() {
|
||||
setPlayingId(null);
|
||||
} else {
|
||||
audioRef.current?.pause();
|
||||
setPlayingId(null);
|
||||
const audio = new Audio(m.sourceUrl);
|
||||
audio.onended = () => setPlayingId(null);
|
||||
audio.onpause = () => setPlayingId(null);
|
||||
audio.play();
|
||||
audio.play().catch(() => setPlayingId(null));
|
||||
audioRef.current = audio;
|
||||
setPlayingId(m.id);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user