feat: enhance audio track plugin with waiting and playing event handling

This commit is contained in:
Harvey Zhao committed 2026-01-04 17:29:05 +08:00
1 parent ece55c5747
commit 23a20d5d6d
5 files changed
+23 -3

No files matched your search

@@ -52,6 +52,18 @@ export default function artplayerPluginAudioTrack(option) {
audio.muted = art.muted
})
art.on('video:waiting', () => {
audio.pause()
})
art.on('video:playing', () => {
if (url && art.playing) {
audio.play().catch((err) => {
console.warn(err)
})
}
})
art.on('destroy', () => {
audio.pause()
audio.src = ''