Jump to content

Sound.fadeTo, fadeOut, fadeIn not working


d0nkeykong
 Share

Recommended Posts

I'm testing in Chrome 38.0.2125.111 and none of these methods are working for me (Phaser 2.1.3)

When I look at the sound object, isPlaying is true but no sound plays unless I just use sound.play() which works as expected.

// OkbgMusic = game.add.audio('intro-music');bgMusic.play();// No soundbgMusic = game.add.audio('intro-music');bgMusic.fadeIn(1000,false)

Can any one help?

Link to comment
Share on other sites

Has the music definitely finished decoding? 1 second isn't very long, audio files can take a while to decode (often more than 1 second) so it might simply be that it's reached full volume by the time it's able to actually play.

 

The following code works fine for me, same build of Chrome, uses assets from the Phaser Examples repo:

var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, render: render });function preload() {    game.load.image('disk', 'assets/sprites/ra_dont_crack_under_pressure.png');    game.load.audio('boden', 'assets/audio/goaman_intro.mp3');}var music;function create() {    game.stage.backgroundColor = '#182d3b';    game.input.touch.preventDefault = false;    music = game.add.audio('boden');    music.onDecoded.add(start, this);    s = game.add.sprite(game.world.centerX, game.world.centerY, 'disk');    s.anchor.setTo(0.5, 0.5);}function start() {    music.fadeIn(4000);}function render() {    game.debug.soundInfo(music, 20, 32);}
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...