Heim > Fragen und Antworten > Hauptteil
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
})
}
}
})
}