提交 b7511492 编写于 作者: D DCloud_LXH

feat(app-plus): 音频api立即触发timeupdate事件

上级 f042fea6
...@@ -172,6 +172,7 @@ onMethod('onAudioStateChange', ({ ...@@ -172,6 +172,7 @@ onMethod('onAudioStateChange', ({
emit(audio, state, errMsg, errCode) emit(audio, state, errMsg, errCode)
if (state === 'play') { if (state === 'play') {
const oldCurrentTime = audio.currentTime const oldCurrentTime = audio.currentTime
emit(audio, 'timeupdate')
audio.__timing = setInterval(() => { audio.__timing = setInterval(() => {
const currentTime = audio.currentTime const currentTime = audio.currentTime
if (currentTime !== oldCurrentTime) { if (currentTime !== oldCurrentTime) {
......
...@@ -75,6 +75,7 @@ function initMusic () { ...@@ -75,6 +75,7 @@ function initMusic () {
function startTimeUpdateTimer () { function startTimeUpdateTimer () {
stopTimeUpdateTimer() stopTimeUpdateTimer()
publishBackgroundAudioStateChange('timeUpdate', {})
timeUpdateTimer = setInterval(() => { timeUpdateTimer = setInterval(() => {
publishBackgroundAudioStateChange('timeUpdate', {}) publishBackgroundAudioStateChange('timeUpdate', {})
}, TIME_UPDATE) }, TIME_UPDATE)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册