微信7.0安卓版backgorund audio api问题
发布于 5 年前 作者 zhangxiuying 1220 次浏览 来自 问答
  • 当前 Bug 的表现

在锁屏或退到后台后,当背景音频播放结束后,微信7.0安卓版不会触发BackgroundAudioManager的onEnded事件,而在旧版本和iOS中均无此问题

  • 预期表现

在锁屏或退到后台后,当背景音频播放结束后,微信7.0安卓版也能触发BackgroundAudioManager的onEnded事件,并能进行音频切换操作

  • 复现路径

锁屏或者按home后,onEnded事件在音频结束后不触发(仅在7.0.0安卓版微信中发生)

  • 提供一个最简复现 Demo

test page

onReady: function () {

    this.bindMusicEvent()

    this.rePlay()

},

bindMusicEvent() {

    const audioManager = wx.getBackgroundAudioManager()

    audioManager.onEnded(() => {

        console.log(‘music onEnded’)

        this.rePlay()

    })

},

rePlay() {

    const audioManager = wx.getBackgroundAudioManager()

    audioManager.stop()

    audioManager.src = https://res.psy-1.com/cosleep/miniapp/breath/start3s.m4a

    audioManager.title = ‘测试’

    audioManager.epname = ‘测试’

    audioManager.singer = ‘’

    audioManager.coverImgUrl = https://res.psy-1.com/miniapp/xiaoshuimian_logo_screen.png

    audioManager.seek(0)

    audioManager.play()

},

4 回复

客户端问题,最近的版本会修复,评估下影响面.

你好 锁屏后音频还能播放么  线上的可以播放  开发版不能

请问一下这个问题解决了吗,遇到同样的问题

回到顶部