爱吃鱼的靖哥哥
爱吃鱼的靖哥哥
  • 发布:2023-08-23 16:07
  • 更新:2023-08-23 16:07
  • 阅读:171

【报Bug】多个innerAudioContext播放音频冲突

分类:uni-app

产品分类: uniapp/App

PC开发环境操作系统: Windows

PC开发环境操作系统版本号: win10专业版1909_18363.592

HBuilderX类型: 正式

HBuilderX版本号: 3.8.12

手机系统: Android

手机系统版本号: Android 11

手机厂商: 华为

手机机型: 荣耀BTR-W09

页面类型: vue

vue版本: vue3

打包方式: 云端

项目创建方式: HBuilderX

示例代码:

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,{});页面内音频突然就没有声音了
···

操作步骤:

预期结果:

能够多个音频同时播放

实际结果:

无声了

bug描述:

App.vue中设置了一个监听事件,按钮点击时发送事件触发音效。在应用内页面播放音频,点击按钮进行操作,只要触发了按钮点击音效事件页面内音频就没有声音了

2023-08-23 16:07 负责人:无 分享
已邀请:

要回复问题请先登录注册