Skip to content

Commit

Permalink
Document the new preload metadata option
Browse files Browse the repository at this point in the history
  • Loading branch information
goldfire committed May 17, 2020
1 parent c960a92 commit 30964ea
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions README.md
Expand Up @@ -192,8 +192,8 @@ The volume of the specific track, from `0.0` to `1.0`.
Set to `true` to force HTML5 Audio. This should be used for large audio files so that you don't have to wait for the full file to be downloaded and decoded before playing.
#### loop `Boolean` `false`
Set to `true` to automatically loop the sound forever.
#### preload `Boolean` `true`
Automatically begin downloading the audio file when the `Howl` is defined.
#### preload `Boolean|String` `true`
Automatically begin downloading the audio file when the `Howl` is defined. If using HTML5 Audio, you can set this to `'metadata'` to only preload the file's metadata (to get its duration without download the entire file, for example).
#### autoplay `Boolean` `false`
Set to `true` to automatically start playback when sound is loaded.
#### mute `Boolean` `false`
Expand Down
4 changes: 2 additions & 2 deletions src/howler.core.js
Expand Up @@ -572,7 +572,7 @@
self._muted = o.mute || false;
self._loop = o.loop || false;
self._pool = o.pool || 5;
self._preload = (typeof o.preload === 'boolean' || typeof o.preload === 'string') ? o.preload : 'none';
self._preload = (typeof o.preload === 'boolean' || o.preload === 'metadata') ? o.preload : true;
self._rate = o.rate || 1;
self._sprite = o.sprite || {};
self._src = (typeof o.src !== 'string') ? o.src : [o.src];
Expand Down Expand Up @@ -626,7 +626,7 @@
}

// Load the source file unless otherwise specified.
if (self._preload === true || self._preload === 'auto' || self._preload === 'metadata') {
if (self._preload && self._preload !== 'none') {
self.load();
}

Expand Down

0 comments on commit 30964ea

Please sign in to comment.