Skip to content

Commit 7c50da1

Browse files
committed
v2.2.1
1 parent 2dbaa5d commit 7c50da1

8 files changed

+53
-15
lines changed

CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## 2.2.1 (Oct 25, 2020)
2+
- `FIXED` The latest Safari 14 changed how WAV support was detected ([#1415](https://github.com/goldfire/howler.js/pull/1415)).
3+
- `FIXED` Edge case that could cause an infinite loop while fading ([#1369](https://github.com/goldfire/howler.js/pull/1369)).
4+
- `FIXED` Calling `seek` without a seek value while a file was still loading no longer adds it to the queue and correctly returns `0` ([#1189](https://github.com/goldfire/howler.js/issues/1189)).
5+
- `FIXED` Correctly handle finite audio files that return `Infinity` duration in Safari ([#658](https://github.com/goldfire/howler.js/pull/658)).
6+
17
## 2.2.0 (May 17, 2020)
28
- `ADDED` New `xhr` property that allows setting custom headers (such as for auth), changing the `withCredentials` setting and specifying the HTTP method for the request. These only apply to Web Audio ([#997](https://github.com/goldfire/howler.js/pull/997)).
39
- `ADDED` New `Howler.stop()` global stop method to stop all sounds at once ([#1308](https://github.com/goldfire/howler.js/issues/1308)).

dist/howler.core.min.js

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/howler.js

+39-7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*!
2-
* howler.js v2.2.0
2+
* howler.js v2.2.1
33
* howlerjs.com
44
*
55
* (c) 2013-2020, James Simpson of GoldFire Studios
@@ -273,7 +273,7 @@
273273
opus: !!audioTest.canPlayType('audio/ogg; codecs="opus"').replace(/^no$/, ''),
274274
ogg: !!audioTest.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/, ''),
275275
oga: !!audioTest.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/, ''),
276-
wav: !!audioTest.canPlayType('audio/wav; codecs="1"').replace(/^no$/, ''),
276+
wav: !!(audioTest.canPlayType('audio/wav; codecs="1"') || audioTest.canPlayType('audio/wav')).replace(/^no$/, ''),
277277
aac: !!audioTest.canPlayType('audio/aac;').replace(/^no$/, ''),
278278
caf: !!audioTest.canPlayType('audio/x-caf;').replace(/^no$/, ''),
279279
m4a: !!(audioTest.canPlayType('audio/x-m4a;') || audioTest.canPlayType('audio/m4a;') || audioTest.canPlayType('audio/aac;')).replace(/^no$/, ''),
@@ -1362,16 +1362,16 @@
13621362
lastTick = Date.now();
13631363
vol += diff * tick;
13641364

1365+
// Round to within 2 decimal points.
1366+
vol = Math.round(vol * 100) / 100;
1367+
13651368
// Make sure the volume is in the right bounds.
13661369
if (diff < 0) {
13671370
vol = Math.max(to, vol);
13681371
} else {
13691372
vol = Math.min(to, vol);
13701373
}
13711374

1372-
// Round to within 2 decimal points.
1373-
vol = Math.round(vol * 100) / 100;
1374-
13751375
// Change the volume.
13761376
if (self._webAudio) {
13771377
sound._volume = vol;
@@ -1604,7 +1604,7 @@
16041604
}
16051605

16061606
// If the sound hasn't loaded, add it to the load queue to seek when capable.
1607-
if (self._state !== 'loaded' || self._playLock) {
1607+
if (typeof seek === 'number' && (self._state !== 'loaded' || self._playLock)) {
16081608
self._queue.push({
16091609
event: 'seek',
16101610
action: function() {
@@ -1746,6 +1746,7 @@
17461746
// Remove any event listeners.
17471747
sounds[i]._node.removeEventListener('error', sounds[i]._errorFn, false);
17481748
sounds[i]._node.removeEventListener(Howler._canPlayEvent, sounds[i]._loadFn, false);
1749+
sounds[i]._node.removeEventListener('ended', sounds[i]._endFn, false);
17491750

17501751
// Release the Audio object back to the pool.
17511752
Howler._releaseHtml5Audio(sounds[i]._node);
@@ -2242,6 +2243,11 @@
22422243
self._loadFn = self._loadListener.bind(self);
22432244
self._node.addEventListener(Howler._canPlayEvent, self._loadFn, false);
22442245

2246+
// Listen for the 'ended' event on the sound to account for edge-case where
2247+
// a finite sound has a duration of Infinity.
2248+
self._endFn = self._endListener.bind(self);
2249+
self._node.addEventListener('ended', self._endFn, false);
2250+
22452251
// Setup the new audio node.
22462252
self._node.src = parent._src;
22472253
self._node.preload = parent._preload === true ? 'auto' : parent._preload;
@@ -2315,6 +2321,32 @@
23152321

23162322
// Clear the event listener.
23172323
self._node.removeEventListener(Howler._canPlayEvent, self._loadFn, false);
2324+
},
2325+
2326+
/**
2327+
* HTML5 Audio ended listener callback.
2328+
*/
2329+
_endListener: function() {
2330+
var self = this;
2331+
var parent = self._parent;
2332+
2333+
// Only handle the `ended`` event if the duration is Infinity.
2334+
if (parent._duration === Infinity) {
2335+
// Update the parent duration to match the real audio duration.
2336+
// Round up the duration to account for the lower precision in HTML5 Audio.
2337+
parent._duration = Math.ceil(self._node.duration * 10) / 10;
2338+
2339+
// Update the sprite that corresponds to the real duration.
2340+
if (parent._sprite.__default[1] === Infinity) {
2341+
parent._sprite.__default[1] = parent._duration * 1000;
2342+
}
2343+
2344+
// Run the regular ended method.
2345+
parent._ended(self);
2346+
}
2347+
2348+
// Clear the event listener since the duration is now correct.
2349+
self._node.removeEventListener('ended', self._endFn, false);
23182350
}
23192351
};
23202352

@@ -2537,7 +2569,7 @@
25372569
/*!
25382570
* Spatial Plugin - Adds support for stereo and 3D audio where Web Audio is supported.
25392571
*
2540-
* howler.js v2.2.0
2572+
* howler.js v2.2.1
25412573
* howlerjs.com
25422574
*
25432575
* (c) 2013-2020, James Simpson of GoldFire Studios

dist/howler.min.js

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/howler.spatial.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "howler",
3-
"version": "2.2.0",
3+
"version": "2.2.1",
44
"description": "Javascript audio library for the modern web.",
55
"homepage": "https://howlerjs.com",
66
"keywords": [

src/howler.core.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*!
2-
* howler.js v2.2.0
2+
* howler.js v2.2.1
33
* howlerjs.com
44
*
55
* (c) 2013-2020, James Simpson of GoldFire Studios

src/plugins/howler.spatial.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*!
22
* Spatial Plugin - Adds support for stereo and 3D audio where Web Audio is supported.
33
*
4-
* howler.js v2.2.0
4+
* howler.js v2.2.1
55
* howlerjs.com
66
*
77
* (c) 2013-2020, James Simpson of GoldFire Studios

0 commit comments

Comments
 (0)