提交 bd7d9cd3 编写于 作者: Q qiang

fix: 修复App端无法获取音频暂停状态的问题

上级 26516432
......@@ -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,
......@@ -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)
}
......
......@@ -113,7 +113,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`
}
......@@ -189,7 +189,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,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册