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.
http://phaser.io
MIT License
1.34k stars 491 forks source link

Phaser crash due to AudioBufferSourceNode #658

Closed QuipHop closed 4 years ago

QuipHop commented 4 years ago

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

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!

samme commented 4 years ago

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.