提交 821bf5f6 编写于 作者: d-u-a's avatar d-u-a

fix(app): BackgroundAudio onPrev onNext 不触发的问题

上级 f32ff4eb
......@@ -158,9 +158,13 @@ function initMusic() {
})
})
// @ts-ignore
audio.addEventListener('prev', () => publish('onBackgroundAudioPrev'))
audio.addEventListener('prev', () => {
onBackgroundAudioPrev()
})
// @ts-ignore
audio.addEventListener('next', () => publish('onBackgroundAudioNext'))
audio.addEventListener('next', () => {
onBackgroundAudioNext()
})
}
function getBackgroundAudioState() {
......@@ -299,6 +303,22 @@ function onBackgroundAudioStateChange({
})
}
function onBackgroundAudioPrev() {
callbacks['prev'].forEach((callback) => {
if (typeof callback === 'function') {
callback({})
}
})
}
function onBackgroundAudioNext() {
callbacks['next'].forEach((callback) => {
if (typeof callback === 'function') {
callback({})
}
})
}
const onInitBackgroundAudioManager = /*#__PURE__*/ once(() => {
eventNames.forEach((item) => {
BackgroundAudioManager.prototype[`on${capitalize(item)}` as onEventNames] =
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册