App.vue中
···
this.btnTapAudioCtx = uni.createInnerAudioContext();
this.btnTapAudioCtx.autoplay = false;
this.btnTapAudioCtx.volume = 1;
this.btnTapAudioCtx.sessionCategory = "ambient";
this.btnTapAudioCtx.src = "/static/mp3/audio_click_sound.wav";
uni.$on("BTN_CLICK_EVENT",()=>{
this.btnTapAudioCtx.play();
});
···
应用内页面:
···
this.innerAudioContext = uni.createInnerAudioContext();
this.innerAudioContext.sessionCategory = "ambient";
this.innerAudioContext.autoplay = false;
this.btnTapAudioCtx.src = this.currAudioSrc;
this.innerAudioContext.play();
此时页面内的音频正常播放,再调用uni.$emit(cs.BTN_CLICK_EVENT,{});页面内音频突然就没有声音了
···
1 个回复
爱吃鱼的靖哥哥 (作者) - 行走在全栈路上的码农
为啥没有人回复啊,官方的大佬都在哪里呢