真机音频播放
发布于 5 年前 作者 jing60 12768 次浏览 来自 问答

onLoad: function () {

var that = this;

this.refreshPlayStatus();

backgroundAudioManager = wx.getBackgroundAudioManager();

backgroundAudioManager.src = http://down.cntaijiquan.com/d/gcw/wm/爱的供养.mp3;

backgroundAudioManager.title = “爱的供养”;

backgroundAudioManager.onTimeUpdate(function (callback) {

console.log(“onTimeUpdate”);

console.log(backgroundAudioManager.duration);

});

backgroundAudioManager.onPlay(function (callback) {

that.setData({

playStatus: 1

});

});

backgroundAudioManager.onPause(function (callback) {

that.setData({

playStatus: 0

});

});

},

play: function (e) {

var that = this;

if (that.data.playStatus == 0) {

backgroundAudioManager.play();

} else {

backgroundAudioManager.pause();

}

},

这个代码在模拟器上是可以的,但是在Iphone上怎么着都无法播放,也不报错,这个是什么问题啊

1 回复

你换成https再试一试

回到顶部