收藏
回答

真机音频播放

问题模块
API和组件

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上怎么着都无法播放,也不报错,这个是什么问题啊

最后一次编辑于  2017-12-20  (未经腾讯允许,不得转载)
邀请回答
复制链接收藏投诉关注问题回答

1 个回答

  • 🍊
    🍊
    2018-01-04

    你换成https再试一试

    2018-01-04
    赞同
    回复