Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AudioLoader and LoadingManager onLoad Race #10706

Open
3 tasks done
seep opened this issue Feb 2, 2017 · 3 comments
Open
3 tasks done

AudioLoader and LoadingManager onLoad Race #10706

seep opened this issue Feb 2, 2017 · 3 comments

Comments

@seep
Copy link

seep commented Feb 2, 2017

Description of the problem

AudioLoader calls scope.manager.itemEnd (through the file loader) after loading the buffer, but its own onLoad after decoding it. Since decoding the buffer is asynchronous (or at least, has a callback) you can get into a race condition if the audio loader is the last loader in the loading manager's queue, where the manager thinks all of it's items are finished but the individual loaders haven't finished parsing. We noticed this in our preloading situation and had to implement our own loading queue that used the per-item onLoad to tick off complete items.

Unfortunately, looking at FileLoader/AudioLoader source, I'm not sure how to fix this or if it's even a concern; maybe the easiest solution to just clarify in the docs that LoadingManager#onLoad only indicates the network request is finished, and doesn't indicate that the data has been parsed.

Three.js version
  • r84
Browser
  • All of them
OS
  • All of them
@mrdoob
Copy link
Owner

mrdoob commented Feb 2, 2017

Hmm, so I guess AudioLoader shouldn't pass the manager to FileLoader and call the functions itself?

@seep
Copy link
Author

seep commented Feb 10, 2017

That would definitely fix it for a custom loading manager. The default loading manager would still ignore the decoding callback, but how many people use the default loading manager in this context?

@richartkeil
Copy link

I experienced the same problem. At the moment it's not possible to securely play an audio file after the managers onLoad callback fired.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants