wx.getBackgroundAudioManager()苹果手机报错
发布于 6 年前 作者 fangli 1957 次浏览 来自 问答

wx.getBackgroundAudioManager()播放,结果ios报错,安卓与编辑器都是正常的,请问问题怎么解决?


2 回复

你好,请提供一下出现问题的机型和微信版本,以及能复现问题的简单代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)。

代码片段为:wechatide://minicode/RLGwOMmz7BLU

手机:iphone 8

系统:ios 11.4

微信版本:6.7

基础版本:2.1.1

也可以参考以下代码:

const backgroundAudioManager = wx.getBackgroundAudioManager()

backgroundAudioManager.title = ‘此时此刻’

backgroundAudioManager.epname = ‘此时此刻’

backgroundAudioManager.singer = ‘许巍’

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

//阿里云的链接

backgroundAudioManager.src = ‘https://in-2f7ac68d58aa11e8975b00163e1c7426.oss-cn-shanghai.aliyuncs.com/video/4472300c-1643505839a-0004-9016-88f-d439f.mp3?Expires=1531133784&OSSAccessKeyId=LTAInFumgYEtNMvC&Signature=t6SmxLhIHWFE%2Bq1mnQVNSEjQ3uw%3D

backgroundAudioManager.onPlay(function() {

console.log(‘开始播放’)

});

backgroundAudioManager.onPause(function() {

console.log(‘暂停播放’)

});

backgroundAudioManager.onWaiting(function() {

console.log(‘加载等待中’)

});

backgroundAudioManager.onEnded(function() {

console.log(‘停止播放’)

});

backgroundAudioManager.onStop(function() {

console.log(‘停止播放’)

});

backgroundAudioManager.onError(function(res) {

console.log(res)

});

回到顶部