微信小程序音效播放

// 答对音效
const answerRightAudio = wx.createInnerAudioContext();
answerRightAudio.autoplay = false;
answerRightAudio.src = 'https://js.runhua.com.cn/sound/right.wav';
// 答错音效
const answerWrongAudio = wx.createInnerAudioContext();
answerWrongAudio.autoplay = false;
answerWrongAudio.src = 'https://js.runhua.com.cn/sound/wrong.mp3';

播放:
answerRightAudio.play()

猜你喜欢

转载自blog.csdn.net/xiaoma19941027/article/details/106290451