html52.com
我爱小程序-开发者交流社区

音频api和背景音乐api在手机上无法播放某些音频源

问题模块 框架类型 问题类型 API/组件名称 终端类型 微信版本 基础库版本
API和组件 小程序 Bug wx.createInnerAudioContext(),wx.getBackgroundAudioManager() 客户端 7.0.5 2.7.7

- 当前 Bug 的表现(可附上截图)

wx.createInnerAudioContext()的

wx.createInnerAudioContext()的wx.getBackgroundAudioManager()的


wx.getBackgroundAudioManager()的

wx.getBackgroundAudioManager()的- 预期表现

- 预期表现

在开发者工具中能正常播放,在手机上就不能行了,希望能够解决这个问题

- 复现路径

音频播放api

代码片段:https://developers.weixin.qq.com/s/OWZGU2mI7pam

背景音乐api

代码片段:https://developers.weixin.qq.com/s/IPZic2mA7KaH


- 提供一个最简复现 Demo

音频播放api

代码片段:https://developers.weixin.qq.com/s/OWZGU2mI7pam

背景音乐api

代码片段:https://developers.weixin.qq.com/s/IPZic2mA7KaH


const innerAudioContext = wx.createInnerAudioContext()

innerAudioContext.autoplay = true

innerAudioContext.src = 'http://lhttp.qingting.fm/live/339/64k.mp3'

innerAudioContext.onPlay(() => {

console.log('开始播放')

})

innerAudioContext.onError((res) => {

console.log(res.errMsg)

console.log(res.errCode)

})

背景音乐api

代码片段:https://developers.weixin.qq.com/s/IPZic2mA7KaH

const backgroundAudioManager = wx.getBackgroundAudioManager()


backgroundAudioManager.title = '此时此刻'

backgroundAudioManager.epname = '此时此刻'

backgroundAudioManager.singer = '许巍'

backgroundAudioManager.coverImgUrl = 'http://y.gtimg.cn/music/photo_new/T002R300x300M000003rsKF44GyaSk.jpg?max_age=2592000'

// 设置了 src 之后会自动播放

backgroundAudioManager.src = 'http://lhttp.qingting.fm/live/339/64k.mp3'


backgroundAudioManager.onError((res) => {


console.log(res.errMsg)


console.log(res.errCode)


})

注:

官方的各位希望您能真正测试完以后再回答,1.我的问题是在真机上不能播放2.代码片段官方已经改成https://developers.weixin.qq.com开头的了,请不要再跟我要老版本的了3.作为官方严谨一点好不好

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

真正的个人免签约支付接口

云免签H5支付