Kha
                                
                                 Kha copied to clipboard
                                
                                    Kha copied to clipboard
                            
                            
                            
                        loading stuck when audio format not supported
Currently if a sound file (converted automatically as part of kha) happen to be not supported (currently happen on safari ios) kha thrown an error.
see : https://github.com/Kode/Kha/blob/bbe457bab53abec65e467525e0bf153009798fb5/Backends/HTML5/kha/js/MobileWebAudioSound.hx#L37
It should instead return a failure callback so the app can deal with it.
I guess a failure to load at https://github.com/Kode/Kha/blob/bbe457bab53abec65e467525e0bf153009798fb5/Backends/HTML5/kha/js/MobileWebAudioSound.hx#L25
should also be sending error so the app can deal with loading errors
I have a basic implementation for that in https://github.com/sh-dave/Kha/tree/asset-loading-failures
- add an optional ?failed: Dynamic -> Voidcallback to every Assets.loadXXX() and Assets.loadXXXFromPath() function- defaults to haxe.Log.traceif no callback is given
 
- defaults to 
- add an failed: Dynamic -> Voidcallback for every LoaderImpl class i could compile
- wraps the LoaderImpl for kore-based-backends in a try/catch
It still requires
- an implementation for the remaining backends
- most likely a change to Assets.loadEverything() to handle errors as well?
Should i put it up as PR in it's current state?
I had a quick look, I like the uncompressSoundsFilter option too. for loadEverything, there could be a callback that return a list of failed asset ? or a callback called for each error (might be better since we can show each error as they happen)
Uhm, I'd rather make sure there are no errors at all.
Well if you use Assets.loadXXXFromPath() you need some kind of failure notification, b/c you never now if it's going to succeed or not.
Sounds reasonable, pull request please.
Aye, will clean it up a bit and prepare a PR. Will go with the callback for each failed assets i think.
Yes, that's cool.
Can be closed now with the merge?