()
| 2079 | } |
| 2080 | |
| 2081 | playAmbientSound () { |
| 2082 | if (!me.get('volume')) { return } |
| 2083 | if (this.ambientSound) { return } |
| 2084 | const file = this.campaign?.get('ambientSound')?.[AudioPlayer.ext.substr(1)] |
| 2085 | if (!file) { return } |
| 2086 | const src = `/file/${file}` |
| 2087 | if (!AudioPlayer.getStatus(src)?.loaded) { |
| 2088 | AudioPlayer.preloadSound(src) |
| 2089 | Backbone.Mediator.subscribeOnce('audio-player:loaded', this.playAmbientSound, this) |
| 2090 | return |
| 2091 | } |
| 2092 | if (this.isMusicPlaybackBlockedByAutoplay()) { |
| 2093 | this.pendingAmbientSound = true |
| 2094 | this.ensureMusicGestureListeners() |
| 2095 | return |
| 2096 | } |
| 2097 | this.ambientSound = createjs.Sound.play(src, { loop: -1, volume: 0.1 }) |
| 2098 | createjs.Tween.get(this.ambientSound).to({ volume: 0.5 }, 1000) |
| 2099 | } |
| 2100 | |
| 2101 | playMusic () { |
| 2102 | const musicFile = '/music/music-menu' |
no test coverage detected