Skip to content

Commit

Permalink
[FIX] audio assets now play if their preload flag is false
Browse files Browse the repository at this point in the history
  • Loading branch information
vkalpias committed Nov 16, 2015
1 parent 634f580 commit 8e97720
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/framework/components/audiosource/audiosource_component.js
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,8 @@ pc.extend(pc, function () {
},

loadAudioSourceAssets: function (ids) {
var self = this;

var assets = ids.map(function (id) {
return this.system.app.assets.get(id);
}, this);
Expand Down Expand Up @@ -290,6 +292,9 @@ pc.extend(pc, function () {
_done();
}
});

if (! asset.resource)
this.system.app.assets.load(asset);
} else {
// don't wait for assets that aren't in the registry
count--;
Expand All @@ -299,8 +304,11 @@ pc.extend(pc, function () {
// but if they are added insert them into source list
this.system.app.assets.on("add:" + ids[index], function (asset) {
asset.ready(function (asset) {
this.data.sources[asset.name] = asset.resource;
self.data.sources[asset.name] = asset.resource;
});

if (! asset.resource)
self.system.app.assets.load(asset);
});
}
}, this);
Expand Down

0 comments on commit 8e97720

Please sign in to comment.