收藏
回答

微信小游戏audio音量调节无用

问题模块 游戏引擎 AppID 操作系统 微信版本 基础库版本
游戏引擎 Egret wx1a6099bbdb29f00f Android 7.0.8 2.9.3
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。

最后一次编辑于  11-16
回答关注问题邀请回答
收藏

1 个回答

  • 小游戏运营专员-宏
    小游戏运营专员-宏
    11-19

    音频是混音还没支持的哈

    11-19
    赞同
    回复 1
    • 🚦
      🚦
      11-19
      什么意思?mp3的不可以用吗
      11-19
      回复
问题标签