Preload embedded HTML5 audio

This commit is contained in:
Joshua Granick
2016-10-05 12:06:27 -07:00
parent 32ceb6f264
commit 944084d6ac
4 changed files with 65 additions and 59 deletions

View File

@@ -196,12 +196,11 @@ class DefaultAssetLibrary extends AssetLibrary {
#elseif html5
return null;
//return new Sound (new URLRequest (path.get (id)));
return Preloader.audioBuffers.get (path.get (id));
#else
if (className.exists(id)) return AudioBuffer.fromBytes (cast (Type.createInstance (className.get (id), []), Bytes));
if (className.exists (id)) return AudioBuffer.fromBytes (cast (Type.createInstance (className.get (id), []), Bytes));
else return AudioBuffer.fromFile (rootPath + path.get (id));
#end
@@ -430,6 +429,10 @@ class DefaultAssetLibrary extends AssetLibrary {
Preloader.images.exists (path.get (id));
case MUSIC, SOUND:
Preloader.audioBuffers.exists (path.get (id));
default:
Preloader.loaders.exists (path.get (id));
@@ -469,7 +472,7 @@ class DefaultAssetLibrary extends AssetLibrary {
var promise = new Promise<AudioBuffer> ();
#if (flash)
#if flash
if (path.exists (id)) {