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

Add an option to fully download the file before starting HTML5 stream #1604

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dos1
Copy link

@dos1 dos1 commented Jun 9, 2022

Issue/Feature

Adds an option to fully download the file before starting HTML5 stream. This can be useful for use cases such as games that use many long background tracks, which are all downloaded before the game starts. Using Web Audio would cause huge memory footprint as all tracks get fully decoded after downloading. Using HTML5 streaming avoids that, but didn't allow to fully download the file beforehand, which now can be done by setting preload property to full.

Solution

Setting preload: 'full' makes Howler download the file via XHR first, and then pass it to Audio object by using Blob object with URL.createObjectURL. The URL is then revoked when Howl is being unloaded.

This can be useful for use cases such as games that use many long background
tracks, which are all downloaded before the game starts. Using Web Audio
would cause huge memory footprint as all tracks get fully decoded
after downloading. Using HTML5 streaming avoids that, but didn't allow
to fully download the file beforehand, which now can be done by setting
`preload` property to `full`.
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

Successfully merging this pull request may close these issues.

None yet

1 participant