- 微信小游戏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。
2019-11-16 - 激励视频offClose
激励视频的RewardedVideoAd.offClose(function callback) 这个API是怎么用的我这样用一直报错 [代码]this[代码][代码].video.offClose( ()=>{[代码] [代码] [代码][代码]console.log([代码][代码]'关闭激励视频关闭按钮监听'[代码][代码]);[代码][代码]});[代码] 报错信息: [图片] 当改成这样以后就不报错了 [代码]function[代码] [代码]ins(){[代码][代码] [代码][代码]console,log([代码][代码]'关闭激励视频关闭按钮监听'[代码][代码]);[代码][代码]}[代码][代码]this[代码][代码].video.offClose( ins() );[代码]但是这个api并没有关闭监听。请问有人遇到过类似的情况吗,能帮忙解答一下吗 我用的是egret
2019-06-24