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

Display audio download progress #107

Open
gabrielwolf opened this issue Aug 19, 2020 · 0 comments
Open

Display audio download progress #107

gabrielwolf opened this issue Aug 19, 2020 · 0 comments

Comments

@gabrielwolf
Copy link

As higher order Ambisonics files are big in size, I want the user to see the download progress.

Maybe the function BufferList.prototype._launchAsyncLoadTaskXHR has to be extended for this.

I added the following lines right before xhr.send(); (line 282 in omnitone.esm.js at the time of writing)

  xhr.onprogress = function(event) {
    if (event.lengthComputable) {
      Utils.log(`Received ${event.loaded} of ${event.total} bytes`);
    } else {
      Utils.log(`Received ${event.loaded} bytes`); // no Content-Length
    }
  };

The result is a console display of the desired values.

Has anybody advice on how to read event.loaded and event.total outside of the Omnitone library?

Thank you in advance!

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

No branches or pull requests

1 participant