Skip to content

Commit 30964ea

Browse files
committed
Document the new preload metadata option
1 parent c960a92 commit 30964ea

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,8 +192,8 @@ The volume of the specific track, from `0.0` to `1.0`.
192192
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.
193193
#### loop `Boolean` `false`
194194
Set to `true` to automatically loop the sound forever.
195-
#### preload `Boolean` `true`
196-
Automatically begin downloading the audio file when the `Howl` is defined.
195+
#### preload `Boolean|String` `true`
196+
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).
197197
#### autoplay `Boolean` `false`
198198
Set to `true` to automatically start playback when sound is loaded.
199199
#### mute `Boolean` `false`

src/howler.core.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -572,7 +572,7 @@
572572
self._muted = o.mute || false;
573573
self._loop = o.loop || false;
574574
self._pool = o.pool || 5;
575-
self._preload = (typeof o.preload === 'boolean' || typeof o.preload === 'string') ? o.preload : 'none';
575+
self._preload = (typeof o.preload === 'boolean' || o.preload === 'metadata') ? o.preload : true;
576576
self._rate = o.rate || 1;
577577
self._sprite = o.sprite || {};
578578
self._src = (typeof o.src !== 'string') ? o.src : [o.src];
@@ -626,7 +626,7 @@
626626
}
627627

628628
// Load the source file unless otherwise specified.
629-
if (self._preload === true || self._preload === 'auto' || self._preload === 'metadata') {
629+
if (self._preload && self._preload !== 'none') {
630630
self.load();
631631
}
632632

0 commit comments

Comments
 (0)