Skip to content

Commit

Permalink
feat(app-plus): 音频api立即触发timeupdate事件
Browse files Browse the repository at this point in the history
  • Loading branch information
StrivingRabbit committed Jan 31, 2023
1 parent f042fea commit b751149
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/core/service/api/context/inner-audio.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ onMethod('onAudioStateChange', ({
emit(audio, state, errMsg, errCode)
if (state === 'play') {
const oldCurrentTime = audio.currentTime
emit(audio, 'timeupdate')
audio.__timing = setInterval(() => {
const currentTime = audio.currentTime
if (currentTime !== oldCurrentTime) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ function initMusic () {

function startTimeUpdateTimer () {
stopTimeUpdateTimer()
publishBackgroundAudioStateChange('timeUpdate', {})
timeUpdateTimer = setInterval(() => {
publishBackgroundAudioStateChange('timeUpdate', {})
}, TIME_UPDATE)
Expand Down

0 comments on commit b751149

Please sign in to comment.