mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-27 17:51:20 -08:00
feat: enhance audio track plugin with waiting and playing event handling
This commit is contained in:
1 parent
ece55c5747
commit
23a20d5d6d
5 files changed
+23
-3
No files matched your search
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "artplayer-plugin-audio-track",
|
||||
"version": "1.0.0",
|
||||
"version": "1.0.1",
|
||||
"description": "audio-track plugin for ArtPlayer",
|
||||
"author": "Harvey Zack <laozhaochaguan@gmail.com>",
|
||||
"license": "MIT",
|
||||
|
||||
@@ -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 = ''
|
||||
|
||||
Reference in new issue
Block a user