Browse Source

音频播放忽略ios静音模式

main
kola-web 3 months ago
parent
commit
2fc21f8e4f
  1. 7
      src/components/customAudioBar/index.ts
  2. 1
      src/module1/pages/chatRoom/index.ts

7
src/components/customAudioBar/index.ts

@ -27,15 +27,16 @@ Component({ @@ -27,15 +27,16 @@ Component({
lifetimes: {
attached() {
const innerAudioContext = wx.createInnerAudioContext();
innerAudioContext.obeyMuteSwitch = false;
this.setData({
innerAudioContext: wx.createInnerAudioContext(),
innerAudioContext,
});
},
detached() {
if (this.data.innerAudioContext) {
this.data.innerAudioContext?.stop();
this.data.innerAudioContext.destroy()
this.data.innerAudioContext.destroy();
}
},
},

1
src/module1/pages/chatRoom/index.ts

@ -62,6 +62,7 @@ Page({ @@ -62,6 +62,7 @@ Page({
this.innerAudioContext = wx.createInnerAudioContext({
useWebAudioImplement: true,
});
this.innerAudioContext.obeyMuteSwitch = false
app.waitLogin().then(() => {
this.getAgree();

Loading…
Cancel
Save