收藏
回答

真机音频播放

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 个回答

  • 🍊
    🍊
    2018-01-04

    你换成https再试一试

    2018-01-04
    有用
    回复
登录 后发表内容