wx.pauseBackgroundAudio()不能暂停音乐咋回事

来源:19-12 playBackgroundAudio-音乐播放基本实现

楼上楼下

2018-11-30

onMusicTap: function (event) {
var currentPostId = this.data.currentPostId;
var postData = postsData.post_list[currentPostId];
var isPlayingMusic = this.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回答

念着你

2019-05-05

1111

0
0

7七月

2018-12-01

这个需要调试下的,不能暂停肯定是状态错了,调试打印排除下。看这代码是看不出来的。

0
0

微信小程序入门与实战(全新版) 超20000人学习的好课

4年同步微信官方迭代,累计20000+人学习, 比微信官方更火爆!

23977 学习 · 6933 问题

查看课程