openfl / starling

Known as the "Cross-Platform Game Engine", Starling is a popular Stage3D framework for OpenFL and Haxe
Other
236 stars 68 forks source link

AssetManager enqueue dose not support mp3 file. #93

Closed galibimtiaz closed 6 years ago

galibimtiaz commented 6 years ago

Currently I am working on a project , all this time I was using AssetManager.addSound("hurt",Assets.getSound("..."));

and It was working fine but when I started to use ,

 AssetManager.enqueue.enqueue([
            Assets.getPath ("assets/sounds/bgGame.mp3"),
        Assets.getPath ("assets/sounds/bgWelcome.mp3")
])

it shows error

Uncaught TypeError: Cannot read property '__name__' of undefined
    at Function.Type.getClassName (Type.hx:53)
    at starling_utils_AssetManager.enqueue (AssetManager.hx:594)
Gama11 commented 6 years ago

Do you have DCE enabled?

galibimtiaz commented 6 years ago

No , I did not enabled DCE, Should I ?

Gama11 commented 6 years ago

No, I just thought your error looks like it could be caused by DCE.

jgranick commented 6 years ago

Looks like there was a case here where it was not handling null well

The null was occurring probably (was this on desktop or mobile?) because MP3 was not supported. OpenFL does not (currently) support MP3 outside of Flash or some web browsers.

We'd recommend using OGG and WAV, then for HTML5, include all three formats (same file name and location in your assets directory) and the Assets system should pick up all three files and support them. However, if you use openfl.utils.Assets, your content should already be preloaded, so Assets.getSound should work instead of Assets.getPath