Skip to content

Commit 97cfa13

Browse files
committed
v2.2.2
1 parent 09a3b28 commit 97cfa13

File tree

8 files changed

+44
-18
lines changed

8 files changed

+44
-18
lines changed

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
## 2.2.2 (June 27, 2021)
2+
The README has been updated with more examples and various clarifications. PRs/issues with suggestions for further improvements are appreciated.
3+
4+
- `CHANGED` Include `keydown` event when unlocking audio ([#1417](https://github.com/goldfire/howler.js/pull/1417)).
5+
- `CHANGED` The audio state is changed to `loading` while the player is buffering ([#1444](https://github.com/goldfire/howler.js/pull/1444)).
6+
- `FIXED` Looping sounds wouldn't always work correctly in recent versions of Firefox desktop ([#1445](https://github.com/goldfire/howler.js/pull/1445)).
7+
- `FIXED` Disabled WebM in Safari 14 until bug in Safar is resolved ([#1476](https://github.com/goldfire/howler.js/issues/1476)).
8+
- `FIXED` Error when calling `seek()` on audio that hasn't loaded ([#1423](https://github.com/goldfire/howler.js/pull/1423)).
9+
- `FIXED` Before a sound had loaded, calling `pause()` after `seek()` didn't have the intended behavior ([#1439](https://github.com/goldfire/howler.js/issues/1439)).
10+
111
## 2.2.1 (Oct 25, 2020)
212
- `FIXED` The latest Safari 14 changed how WAV support was detected ([#1415](https://github.com/goldfire/howler.js/pull/1415)).
313
- `FIXED` Edge case that could cause an infinite loop while fading ([#1369](https://github.com/goldfire/howler.js/pull/1369)).

dist/howler.core.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/howler.js

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*!
2-
* howler.js v2.2.1
2+
* howler.js v2.2.2
33
* howlerjs.com
44
*
55
* (c) 2013-2020, James Simpson of GoldFire Studios
@@ -264,8 +264,11 @@
264264
var mpegTest = audioTest.canPlayType('audio/mpeg;').replace(/^no$/, '');
265265

266266
// Opera version <33 has mixed MP3 support, so we need to check for and block it.
267-
var checkOpera = self._navigator && self._navigator.userAgent.match(/OPR\/([0-6].)/g);
267+
var ua = self._navigator ? self._navigator.userAgent : '';
268+
var checkOpera = ua.match(/OPR\/([0-6].)/g);
268269
var isOldOpera = (checkOpera && parseInt(checkOpera[0].split('/')[1], 10) < 33);
270+
var checkSafari = ua.indexOf('Safari') !== -1 && ua.indexOf('Chrome') === -1;
271+
var isOldSafari = (checkSafari && parseInt(ua.match(/Version\/(.*?) /)[1], 10) < 15);
269272

270273
self._codecs = {
271274
mp3: !!(!isOldOpera && (mpegTest || audioTest.canPlayType('audio/mp3;').replace(/^no$/, ''))),
@@ -279,8 +282,8 @@
279282
m4a: !!(audioTest.canPlayType('audio/x-m4a;') || audioTest.canPlayType('audio/m4a;') || audioTest.canPlayType('audio/aac;')).replace(/^no$/, ''),
280283
m4b: !!(audioTest.canPlayType('audio/x-m4b;') || audioTest.canPlayType('audio/m4b;') || audioTest.canPlayType('audio/aac;')).replace(/^no$/, ''),
281284
mp4: !!(audioTest.canPlayType('audio/x-mp4;') || audioTest.canPlayType('audio/mp4;') || audioTest.canPlayType('audio/aac;')).replace(/^no$/, ''),
282-
weba: !!audioTest.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/, ''),
283-
webm: !!audioTest.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/, ''),
285+
weba: !!(!isOldSafari && audioTest.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/, '')),
286+
webm: !!(!isOldSafari && audioTest.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/, '')),
284287
dolby: !!audioTest.canPlayType('audio/mp4; codecs="ec-3"').replace(/^no$/, ''),
285288
flac: !!(audioTest.canPlayType('audio/x-flac;') || audioTest.canPlayType('audio/flac;')).replace(/^no$/, '')
286289
};
@@ -392,6 +395,7 @@
392395
document.removeEventListener('touchstart', unlock, true);
393396
document.removeEventListener('touchend', unlock, true);
394397
document.removeEventListener('click', unlock, true);
398+
document.removeEventListener('keydown', unlock, true);
395399

396400
// Let all sounds know that audio has been unlocked.
397401
for (var i=0; i<self._howls.length; i++) {
@@ -404,6 +408,7 @@
404408
document.addEventListener('touchstart', unlock, true);
405409
document.addEventListener('touchend', unlock, true);
406410
document.addEventListener('click', unlock, true);
411+
document.addEventListener('keydown', unlock, true);
407412

408413
return self;
409414
},
@@ -915,6 +920,7 @@
915920
node._unlocked = true;
916921
if (!internal) {
917922
self._emit('play', sound._id);
923+
} else {
918924
self._loadQueue();
919925
}
920926
})
@@ -931,7 +937,6 @@
931937
self._playLock = false;
932938
setParams();
933939
self._emit('play', sound._id);
934-
self._loadQueue();
935940
}
936941

937942
// Setting rate before playing won't work in IE, so we set it again here.
@@ -974,8 +979,11 @@
974979
playHtml5();
975980
} else {
976981
self._playLock = true;
982+
self._state = 'loading';
977983

978984
var listener = function() {
985+
self._state = 'loaded';
986+
979987
// Begin playback.
980988
playHtml5();
981989

@@ -1463,6 +1471,12 @@
14631471
if (loop) {
14641472
sound._node.bufferSource.loopStart = sound._start || 0;
14651473
sound._node.bufferSource.loopEnd = sound._stop;
1474+
1475+
// If playing, restart playback to ensure looping updates.
1476+
if (self.playing(ids[i])) {
1477+
self.pause(ids[i], true);
1478+
self.play(ids[i], true);
1479+
}
14661480
}
14671481
}
14681482
}
@@ -1582,7 +1596,9 @@
15821596
// Determine the values based on arguments.
15831597
if (args.length === 0) {
15841598
// We will simply return the current position of the first node.
1585-
id = self._sounds[0]._id;
1599+
if (self._sounds.length) {
1600+
id = self._sounds[0]._id;
1601+
}
15861602
} else if (args.length === 1) {
15871603
// First check if this is an ID, and if not, assume it is a new seek position.
15881604
var ids = self._getSoundIds();
@@ -1600,7 +1616,7 @@
16001616

16011617
// If there is no ID, bail out.
16021618
if (typeof id === 'undefined') {
1603-
return self;
1619+
return 0;
16041620
}
16051621

16061622
// If the sound hasn't loaded, add it to the load queue to seek when capable.
@@ -1638,12 +1654,12 @@
16381654

16391655
// Seek and emit when ready.
16401656
var seekAndEmit = function() {
1641-
self._emit('seek', id);
1642-
16431657
// Restart the playback if the sound was playing.
16441658
if (playing) {
16451659
self.play(id, true);
16461660
}
1661+
1662+
self._emit('seek', id);
16471663
};
16481664

16491665
// Wait for the play lock to be unset before emitting (HTML5 Audio).
@@ -2569,7 +2585,7 @@
25692585
/*!
25702586
* Spatial Plugin - Adds support for stereo and 3D audio where Web Audio is supported.
25712587
*
2572-
* howler.js v2.2.1
2588+
* howler.js v2.2.2
25732589
* howlerjs.com
25742590
*
25752591
* (c) 2013-2020, James Simpson of GoldFire Studios

dist/howler.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/howler.spatial.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

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

src/howler.core.js

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

src/plugins/howler.spatial.js

Lines changed: 1 addition & 1 deletion
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.1
4+
* howler.js v2.2.2
55
* howlerjs.com
66
*
77
* (c) 2013-2020, James Simpson of GoldFire Studios

0 commit comments

Comments
 (0)