这个问题有恢复吗? 还是解决不了了吖? 2023年了依然有这个问题
微信小游戏audio音量调节无用[代码]class WxSoundManager {[代码][代码] [代码][代码]private static _instance: WxSoundManager = [代码][代码]new[代码] [代码]WxSoundManager;[代码][代码] [代码][代码]public static getIns(): WxSoundManager {[代码][代码] [代码][代码]return[代码] [代码]this[代码][代码]._instance;[代码][代码] [代码][代码]}[代码][代码] [代码][代码]private audio: InnerAudioContext = [代码][代码]null[代码][代码];[代码] [代码] [代码][代码]private constructor() {[代码][代码] [代码][代码]}[代码][代码] [代码][代码]public bgMPlay() {[代码][代码] [代码][代码]if[代码] [代码](![代码][代码]this[代码][代码].audio) {[代码][代码] [代码][代码]this[代码][代码].audio = wx.createInnerAudioContext();[代码][代码] [代码][代码]this[代码][代码].audio.src = GameConst.soundRes.bgm;[代码][代码] [代码][代码]this[代码][代码].audio.loop = [代码][代码]true[代码][代码];[代码][代码] [代码][代码]this[代码][代码].audio.volume = GameDataManager.ins.bgmVolume;[代码][代码] [代码][代码]this[代码][代码].audio.stop();[代码][代码] [代码][代码]this[代码][代码].audio.play();[代码][代码] [代码][代码]return[代码][代码];[代码][代码] [代码][代码]} [代码][代码]else[代码] [代码]{[代码][代码] [代码][代码]if[代码] [代码]([代码][代码]this[代码][代码].audio.paused) {[代码][代码] [代码][代码]this[代码][代码].audio.play();[代码][代码] [代码][代码]this[代码][代码].audio.volume = GameDataManager.ins.bgmVolume;[代码][代码] [代码][代码]}[代码][代码] [代码][代码]}[代码][代码] [代码][代码]}[代码][代码] [代码][代码]public bgMStop() {[代码][代码] [代码][代码]if[代码] [代码]([代码][代码]this[代码][代码].audio) {[代码][代码] [代码][代码]this[代码][代码].audio.stop();[代码][代码] [代码][代码]this[代码][代码].audio.destroy();[代码][代码] [代码][代码]this[代码][代码].audio = [代码][代码]null[代码][代码];[代码][代码] [代码][代码]}[代码][代码] [代码][代码]}[代码][代码] [代码][代码]public bgMPause() {[代码][代码] [代码][代码]if[代码] [代码]([代码][代码]this[代码][代码].audio) {[代码][代码] [代码][代码]this[代码][代码].audio.pause();[代码][代码] [代码][代码]}[代码][代码] [代码][代码]}[代码][代码] [代码][代码]public setBgmVolume(volume: number) {[代码][代码] [代码][代码]if[代码][代码]([代码][代码]this[代码][代码].audio) {[代码][代码] [代码][代码]this[代码][代码].audio.volume = volume;[代码][代码] [代码][代码]}[代码][代码] [代码][代码]}[代码][代码] [代码][代码]public soundEffectPlay(_url: string) {[代码][代码] [代码][代码]let effect: InnerAudioContext = wx.createInnerAudioContext();[代码][代码] [代码][代码]effect.src = _url;[代码][代码] [代码][代码]effect.volume = GameDataManager.ins.soundEffVolume;[代码][代码] [代码][代码]effect.stop();[代码][代码] [代码][代码]effect.play();[代码][代码] [代码][代码]effect.onEnded(() => {[代码][代码] [代码][代码]effect.destroy();[代码][代码] [代码][代码]});[代码][代码] [代码][代码]}[代码][代码]}[代码]audio的volume属性在微信开发者工具上没有问题,在真机上完全没有起到任何作用,背景音乐、背景音效播放的都是音频原始音量。请问有人遇到相同的问题吗,该怎么解决?我用的是Egret5.2.29,开发者工具是最新版本,手机是红米K20,Android9。
2023-03-20