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({
lifetimes: { lifetimes: {
attached() { attached() {
const innerAudioContext = wx.createInnerAudioContext();
innerAudioContext.obeyMuteSwitch = false;
this.setData({ this.setData({
innerAudioContext: wx.createInnerAudioContext(), innerAudioContext,
}); });
}, },
detached() { detached() {
if (this.data.innerAudioContext) { if (this.data.innerAudioContext) {
this.data.innerAudioContext?.stop(); this.data.innerAudioContext?.stop();
this.data.innerAudioContext.destroy() this.data.innerAudioContext.destroy();
} }
}, },
}, },

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

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

Loading…
Cancel
Save