LoadQueue gets messed up with duplicate "src" items loaded in other queues
cmam opened this issue · 1 comments
Issue Details
- Version used (Ex; 1.0):
1.0.1
- Describe whats happening (Include any relevant console errors, a Gist is preferred for longer errors):
When having multiple LoadQueue instances, if manifests contain the same file, or the same file with different ID is loaded on a queue, the queue progress is >= 1, causing relevant checks to fail (e.g. is my sound queue ready?). This means that, per queue, the numItems
is less than numLoadedItems
resulting in the loaded
property being false
and progress
being something greater than 1.
What's concerning is that if I load a manifest on another queue, the "original" queue that happens to have loaded a file from that manifest (i.e. same "src" property), gets messed up as described above.
Example:
m1 = [ {src: 'path/sound.ogg', id: 's1' } ];
m2 = [ {src: 'path/sound.ogg', id: 's2' } ];
q1 = new createjs.LoadQueue(true);
q1.installPlugin(createjs.Sound);
q2 = new createjs.LoadQueue(true);
q2.installPlugin(createjs.Sound);
q1.loadManifest(m1);
q1
// All seem good.
loaded: true
progress: 1
numItems: 1
numItemsLoaded: 1
// Load the manifest on the other queue.
q2.loadManifest(m2);
q1
// It gets messed up, for every loadManifest run on any other queue, even though I specify different ID.
loaded: false
progress: 2
numItems: 1
numItemsLoaded: 2
q2
loaded: true
progress: 1
numItems: 1
numItemsLoaded: 1
I hope it makes sense. I guess this has something to do with the global sound registering part, recognizing already loaded "src" paths, but I expect it shouldn't affect the other load queues.
- OS & Browser version (Please be specific) (Ex; Windows 10 Home, Chrome 62.0.3202.94):
Debian Testing, Google Chrome 91.0.4472.114.
- Do you know of any workarounds?
None, other than having to create duplicate files in different paths in order to avoid this.
- Provide any extra details that will help us fix your issue. Including a link to a CodePen.io or JSFiddle.net example that shows the issue in isolation will greatly increase the chance of getting a quick response.
This does make sense. If you can dig into the preloadjs code and see what can be done to avoid it, that would be great. The main devs are on to other things but we are doing our best to maintain issues - somewhat as a community. So ideally, that would be through a pull request. Cheers.