Skip to content

Commit

Permalink
fix: 修复App端无法获取音频暂停状态的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
zhetengbiji committed Apr 7, 2020
1 parent a227f18 commit fb00949
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/platforms/app-plus/service/api/context/audio.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ export function getAudioState ({
errMsg: 'getAudioState:ok',
duration: 1e3 * (audio.getDuration() || 0),
currentTime: audio.isStopped ? 0 : 1e3 * audio.getPosition(),
paused: audio.isPaused,
paused: audio.isPaused(),
src,
volume,
startTime: 1e3 * startTime,
Expand All @@ -138,7 +138,7 @@ export function operateAudio ({
const audio = audios[audioId]
const operationTypes = ['play', 'pause', 'stop']
if (operationTypes.indexOf(operationType) >= 0) {
audio[operationType === operationTypes[0] && audio.isPaused ? 'resume' : operationType]()
audio[operationType === operationTypes[0] && audio.isPaused() ? 'resume' : operationType]()
} else if (operationType === 'seek') {
audio.seekTo(currentTime / 1e3)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export function getMusicPlayerState () {
dataUrl: audio.src,
duration: audio.getDuration() || 0,
currentPosition: audio.getPosition(),
status: audio.isPaused ? 0 : 1,
status: audio.isPaused() ? 0 : 1,
downloadPercent: Math.round(100 * audio.getBuffered() / audio.getDuration()),
errMsg: `getMusicPlayerState:ok`
}
Expand Down Expand Up @@ -165,7 +165,7 @@ export function getBackgroundAudioState () {
let newData = {
duration: audio.getDuration() || 0,
currentTime: audio.isStopped ? 0 : audio.getPosition(),
paused: audio.isPaused,
paused: audio.isPaused(),
src: audio.src,
buffered: audio.getBuffered(),
title: audio.title,
Expand Down

0 comments on commit fb00949

Please sign in to comment.