收藏
回答

微信小游戏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。

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

3 个回答

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

    音频是混音还没支持的哈

    2019-11-19
    有用
    回复 2
    • 🚦
      🚦
      2019-11-19
      什么意思?mp3的不可以用吗
      2019-11-19
      回复
    • a—kun
      a—kun
      2020-04-19
      你好,这个混音的音频还没支持么
      2020-04-19
      回复
  • 缘の翼🕊
    缘の翼🕊
    2023-03-20

    这个问题有恢复吗? 还是解决不了了吖? 2023年了依然有这个问题

    2023-03-20
    有用
    回复
  • jd
    jd
    2020-03-22

    非常抱歉,我们将会在最近的版本修复该问题

    2020-03-22
    有用
    回复
登录 后发表内容
问题标签