代码一样 仍不同步
来源:19-15 监听播放事件完善音乐播放
 
			女神旭
2017-09-22
// 音乐监听函数
      var that = this;
      wx.onBackgroundAudioPlay(function () {
         that.setData({
            isPlayingMusic: true
         })
      });
      wx.onBackgroundAudioPause(function () {
         that.setData({
            isPlayingMusic: false
         })
      });
// 音乐播放
   onMusicTap: function (event) {
      var CurrentPostId = this.data.CurrentPostId;
      var postData = postsData.postList[CurrentPostId];
      var isPlayingMusic = this.data.isPlayingMusic;
      if (isPlayingMusic) {
         wx.pauseBackgroundAudio();
         this.setData({
            isPlayingMusic : false
         })
      }
      else {
         wx.playBackgroundAudio({
            dataUrl: postData.music.url,
            title: postData.music.title,
            coverImgUrl: postData.music.coverImg,
         })
         this.setData({
            isPlayingMusic : true
         })
      }
   },写回答
	2回答
- 
				
				什么是不同步,和源码对比了吗 022017-09-22
- 
				  慕虎5376285 2018-02-03 你是不是 把音乐监听函数单独写在page里了? 00
相似问题
 
						