Home  >  Q&A  >  body text

There is no response when clicking play, and no error is reported; if you do not write to play music, get cannot obtain the music status.

playerMusicTap:function(event){

var that = this;

//获取音乐播放状态

wx.getBackgroundAudioPlayerState({

success:function(res) {

const status = res.status;

if(status != 1){

wx.playBackgroundAudio({

dataUrl: newsData.initData[that.data.newsid].music.url,

title: newsData.initData[that.data.newsid].music.title,

coverImgUrl: ''

})

that.setData({

isPlayer:true

})

}else{

wx.pauseBackgroundAudio();

that.setData({

isPlayer: false

})

}

}

})


}


杨茹杨茹2138 days ago1262

reply all(0)I'll reply

No reply
  • Cancelreply