Skip to content

Commit

Permalink
v2.2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
goldfire committed Oct 25, 2020
1 parent 2dbaa5d commit 7c50da1
Show file tree
Hide file tree
Showing 8 changed files with 53 additions and 15 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## 2.2.1 (Oct 25, 2020)
- `FIXED` The latest Safari 14 changed how WAV support was detected ([#1415](https://github.com/goldfire/howler.js/pull/1415)).
- `FIXED` Edge case that could cause an infinite loop while fading ([#1369](https://github.com/goldfire/howler.js/pull/1369)).
- `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)).
- `FIXED` Correctly handle finite audio files that return `Infinity` duration in Safari ([#658](https://github.com/goldfire/howler.js/pull/658)).

## 2.2.0 (May 17, 2020)
- `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)).
- `ADDED` New `Howler.stop()` global stop method to stop all sounds at once ([#1308](https://github.com/goldfire/howler.js/issues/1308)).
Expand Down
4 changes: 2 additions & 2 deletions dist/howler.core.min.js

Large diffs are not rendered by default.

46 changes: 39 additions & 7 deletions dist/howler.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* howler.js v2.2.0
* howler.js v2.2.1
* howlerjs.com
*
* (c) 2013-2020, James Simpson of GoldFire Studios
Expand Down Expand Up @@ -273,7 +273,7 @@
opus: !!audioTest.canPlayType('audio/ogg; codecs="opus"').replace(/^no$/, ''),
ogg: !!audioTest.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/, ''),
oga: !!audioTest.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/, ''),
wav: !!audioTest.canPlayType('audio/wav; codecs="1"').replace(/^no$/, ''),
wav: !!(audioTest.canPlayType('audio/wav; codecs="1"') || audioTest.canPlayType('audio/wav')).replace(/^no$/, ''),
aac: !!audioTest.canPlayType('audio/aac;').replace(/^no$/, ''),
caf: !!audioTest.canPlayType('audio/x-caf;').replace(/^no$/, ''),
m4a: !!(audioTest.canPlayType('audio/x-m4a;') || audioTest.canPlayType('audio/m4a;') || audioTest.canPlayType('audio/aac;')).replace(/^no$/, ''),
Expand Down Expand Up @@ -1362,16 +1362,16 @@
lastTick = Date.now();
vol += diff * tick;

// Round to within 2 decimal points.
vol = Math.round(vol * 100) / 100;

// Make sure the volume is in the right bounds.
if (diff < 0) {
vol = Math.max(to, vol);
} else {
vol = Math.min(to, vol);
}

// Round to within 2 decimal points.
vol = Math.round(vol * 100) / 100;

// Change the volume.
if (self._webAudio) {
sound._volume = vol;
Expand Down Expand Up @@ -1604,7 +1604,7 @@
}

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

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

// Listen for the 'ended' event on the sound to account for edge-case where
// a finite sound has a duration of Infinity.
self._endFn = self._endListener.bind(self);
self._node.addEventListener('ended', self._endFn, false);

// Setup the new audio node.
self._node.src = parent._src;
self._node.preload = parent._preload === true ? 'auto' : parent._preload;
Expand Down Expand Up @@ -2315,6 +2321,32 @@

// Clear the event listener.
self._node.removeEventListener(Howler._canPlayEvent, self._loadFn, false);
},

/**
* HTML5 Audio ended listener callback.
*/
_endListener: function() {
var self = this;
var parent = self._parent;

// Only handle the `ended`` event if the duration is Infinity.
if (parent._duration === Infinity) {
// Update the parent duration to match the real audio duration.
// Round up the duration to account for the lower precision in HTML5 Audio.
parent._duration = Math.ceil(self._node.duration * 10) / 10;

// Update the sprite that corresponds to the real duration.
if (parent._sprite.__default[1] === Infinity) {
parent._sprite.__default[1] = parent._duration * 1000;
}

// Run the regular ended method.
parent._ended(self);
}

// Clear the event listener since the duration is now correct.
self._node.removeEventListener('ended', self._endFn, false);
}
};

Expand Down Expand Up @@ -2537,7 +2569,7 @@
/*!
* Spatial Plugin - Adds support for stereo and 3D audio where Web Audio is supported.
*
* howler.js v2.2.0
* howler.js v2.2.1
* howlerjs.com
*
* (c) 2013-2020, James Simpson of GoldFire Studios
Expand Down
4 changes: 2 additions & 2 deletions dist/howler.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/howler.spatial.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "howler",
"version": "2.2.0",
"version": "2.2.1",
"description": "Javascript audio library for the modern web.",
"homepage": "https://howlerjs.com",
"keywords": [
Expand Down
2 changes: 1 addition & 1 deletion src/howler.core.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* howler.js v2.2.0
* howler.js v2.2.1
* howlerjs.com
*
* (c) 2013-2020, James Simpson of GoldFire Studios
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/howler.spatial.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*!
* Spatial Plugin - Adds support for stereo and 3D audio where Web Audio is supported.
*
* howler.js v2.2.0
* howler.js v2.2.1
* howlerjs.com
*
* (c) 2013-2020, James Simpson of GoldFire Studios
Expand Down

0 comments on commit 7c50da1

Please sign in to comment.