phaserjs / phaser-ce

Phaser CE is a fun, free and fast 2D game framework for making HTML5 games for desktop and mobile web browsers, supporting Canvas and WebGL rendering.

Home Page:http://phaser.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Phaser crash due to AudioBufferSourceNode

QuipHop opened this issue · comments

I'm using Cordova with Phaser and some of devices got error on the preload state (mostly on Meizu devices)

  • Phaser version(s): 2.10.0
  • What steps produce the bug:
    I have a bunch of mp3/ogg files loaded at preload function using
    this.load.audio('somesound', 'assets/sounds/somesound.mp3');
    then at create function:
    this.sm.sounds.somesound= this.game.add.audio('somesound');
    And then just push these sounds into soundsArr (as Phaser's Sound objects).
    Then at create function I'm calling
    this.game.sound.setDecodedCallback(soundsArr, () => { this.state.start('Game'); });

Then I see an error and black screen in most of cases (sometimes it does load the new state and then hangs)
The error is : Failed to execute 'start' on 'AudioBufferSourceNode': Duration must be a finite non-negative number: NaN;

I've tried to debug and the first thing I have noticed- the array of sounds contains only one first element where the buffer property is not a null but AudioBuffer.

I understand that the issue is tricky and can't be reproduces in most of cases so at least I'm trying to find the way where to dig.
Thanks in advice!

commented

I think setDecodedCallback() should be called only once. Are you doing that?

How are you playing the sounds? I'm assuming Failed to execute 'start' eventually comes from play().

Can you post the code for these two states, or at least enough to reproduce the audio part?

the array of sounds contains only one first element where the buffer property is not a null but AudioBuffer.

Is this before you call setDecodedCallback() or after?

buffer would be correct but it seems all your sounds should be there.