Skip to content

Commit 030db91

Browse files
committed
v2.1.2
1 parent 430276c commit 030db91

8 files changed

+52
-25
lines changed

CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## 2.1.2 (April 19, 2019)
2+
- `FIXED` Removed browser check for auto play unlock since all major browsers now implement this.
3+
- `FIXED` Live streams now stop downloading when they are stopped, also fixing issue in Chrome with stopping twice ([#1129](https://github.com/goldfire/howler.js/issues/1129)).
4+
- `FIXED` Prevent error in Edge when `Audio` isn't supported ([#1147](https://github.com/goldfire/howler.js/issues/1147)).
5+
16
## 2.1.1 (December 21, 2018)
27
- `FIXED` Regression that broke simple play/pause usage in certain edge cases ([#1101](https://github.com/goldfire/howler.js/issues/1101)).
38
- `FIXED` Loading and unloading multiple Howls with the same src could cause them all to unload ([#1103](https://github.com/goldfire/howler.js/issues/1103)).

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-17
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/*!
2-
* howler.js v2.1.1
2+
* howler.js v2.1.2
33
* howlerjs.com
44
*
5-
* (c) 2013-2018, James Simpson of GoldFire Studios
5+
* (c) 2013-2019, James Simpson of GoldFire Studios
66
* goldfirestudios.com
77
*
88
* MIT License
@@ -282,9 +282,8 @@
282282
_unlockAudio: function() {
283283
var self = this || Howler;
284284

285-
// Only run this on certain browsers/devices.
286-
var shouldUnlock = /iPhone|iPad|iPod|Android|BlackBerry|BB10|Silk|Mobi|Chrome|Safari/i.test(self._navigator && self._navigator.userAgent);
287-
if (self._audioUnlocked || !self.ctx || !shouldUnlock) {
285+
// Only run this if Web Audio is supported and it hasn't already been unlocked.
286+
if (self._audioUnlocked || !self.ctx) {
288287
return;
289288
}
290289

@@ -314,14 +313,18 @@
314313
// This must occur before WebAudio setup or the source.onended
315314
// event will not fire.
316315
for (var i=0; i<self.html5PoolSize; i++) {
317-
var audioNode = new Audio();
316+
try {
317+
var audioNode = new Audio();
318318

319-
// Mark this Audio object as unlocked to ensure it can get returned
320-
// to the unlocked pool when released.
321-
audioNode._unlocked = true;
319+
// Mark this Audio object as unlocked to ensure it can get returned
320+
// to the unlocked pool when released.
321+
audioNode._unlocked = true;
322322

323-
// Add the audio node to the pool.
324-
self._releaseHtml5Audio(audioNode);
323+
// Add the audio node to the pool.
324+
self._releaseHtml5Audio(audioNode);
325+
} catch (e) {
326+
self.noAudio = true;
327+
}
325328
}
326329

327330
// Loop through any assigned audio nodes and unlock them.
@@ -934,6 +937,12 @@
934937
}
935938
};
936939

940+
// If this is streaming audio, make sure the src is set and load again.
941+
if (node.src === 'data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA') {
942+
node.src = self._src;
943+
node.load();
944+
}
945+
937946
// Play immediately if ready, or wait for the 'canplaythrough'e vent.
938947
var loadedNoReadyState = (window && window.ejecta) || (!node.readyState && Howler._navigator.isCocoonJS);
939948
if (node.readyState >= 3 || loadedNoReadyState) {
@@ -1084,6 +1093,11 @@
10841093
} else if (!isNaN(sound._node.duration) || sound._node.duration === Infinity) {
10851094
sound._node.currentTime = sound._start || 0;
10861095
sound._node.pause();
1096+
1097+
// If this is a live stream, stop download once the audio is stopped.
1098+
if (sound._node.duration === Infinity) {
1099+
self._clearSound(sound._node);
1100+
}
10871101
}
10881102
}
10891103

@@ -1699,10 +1713,7 @@
16991713
// Remove the source or disconnect.
17001714
if (!self._webAudio) {
17011715
// Set the source to 0-second silence to stop any downloading (except in IE).
1702-
var checkIE = /MSIE |Trident\//.test(Howler._navigator && Howler._navigator.userAgent);
1703-
if (!checkIE) {
1704-
sounds[i]._node.src = 'data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA';
1705-
}
1716+
self._clearSound(sounds[i]._node);
17061717

17071718
// Remove any event listeners.
17081719
sounds[i]._node.removeEventListener('error', sounds[i]._errorFn, false);
@@ -2120,6 +2131,17 @@
21202131
node.bufferSource = null;
21212132

21222133
return self;
2134+
},
2135+
2136+
/**
2137+
* Set the source to a 0-second silence to stop any downloading (except in IE).
2138+
* @param {Object} node Audio node to clear.
2139+
*/
2140+
_clearSound: function(node) {
2141+
var checkIE = /MSIE |Trident\//.test(Howler._navigator && Howler._navigator.userAgent);
2142+
if (!checkIE) {
2143+
node.src = 'data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA';
2144+
}
21232145
}
21242146
};
21252147

@@ -2479,10 +2501,10 @@
24792501
/*!
24802502
* Spatial Plugin - Adds support for stereo and 3D audio where Web Audio is supported.
24812503
*
2482-
* howler.js v2.1.1
2504+
* howler.js v2.1.2
24832505
* howlerjs.com
24842506
*
2485-
* (c) 2013-2018, James Simpson of GoldFire Studios
2507+
* (c) 2013-2019, James Simpson of GoldFire Studios
24862508
* goldfirestudios.com
24872509
*
24882510
* MIT License

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.1.1",
3+
"version": "2.1.2",
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.1.1
2+
* howler.js v2.1.2
33
* howlerjs.com
44
*
55
* (c) 2013-2019, 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.1.1
4+
* howler.js v2.1.2
55
* howlerjs.com
66
*
77
* (c) 2013-2019, James Simpson of GoldFire Studios

0 commit comments

Comments
 (0)