Skip to content

Commit

Permalink
v2.1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
goldfire committed Apr 19, 2019
1 parent 430276c commit 030db91
Show file tree
Hide file tree
Showing 8 changed files with 52 additions and 25 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 2.1.2 (April 19, 2019)
- `FIXED` Removed browser check for auto play unlock since all major browsers now implement this.
- `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)).
- `FIXED` Prevent error in Edge when `Audio` isn't supported ([#1147](https://github.com/goldfire/howler.js/issues/1147)).

## 2.1.1 (December 21, 2018)
- `FIXED` Regression that broke simple play/pause usage in certain edge cases ([#1101](https://github.com/goldfire/howler.js/issues/1101)).
- `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)).
Expand Down
4 changes: 2 additions & 2 deletions dist/howler.core.min.js

Large diffs are not rendered by default.

56 changes: 39 additions & 17 deletions dist/howler.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/*!
* howler.js v2.1.1
* howler.js v2.1.2
* howlerjs.com
*
* (c) 2013-2018, James Simpson of GoldFire Studios
* (c) 2013-2019, James Simpson of GoldFire Studios
* goldfirestudios.com
*
* MIT License
Expand Down Expand Up @@ -282,9 +282,8 @@
_unlockAudio: function() {
var self = this || Howler;

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

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

// Mark this Audio object as unlocked to ensure it can get returned
// to the unlocked pool when released.
audioNode._unlocked = true;
// Mark this Audio object as unlocked to ensure it can get returned
// to the unlocked pool when released.
audioNode._unlocked = true;

// Add the audio node to the pool.
self._releaseHtml5Audio(audioNode);
// Add the audio node to the pool.
self._releaseHtml5Audio(audioNode);
} catch (e) {
self.noAudio = true;
}
}

// Loop through any assigned audio nodes and unlock them.
Expand Down Expand Up @@ -934,6 +937,12 @@
}
};

// If this is streaming audio, make sure the src is set and load again.
if (node.src === 'data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA') {
node.src = self._src;
node.load();
}

// Play immediately if ready, or wait for the 'canplaythrough'e vent.
var loadedNoReadyState = (window && window.ejecta) || (!node.readyState && Howler._navigator.isCocoonJS);
if (node.readyState >= 3 || loadedNoReadyState) {
Expand Down Expand Up @@ -1084,6 +1093,11 @@
} else if (!isNaN(sound._node.duration) || sound._node.duration === Infinity) {
sound._node.currentTime = sound._start || 0;
sound._node.pause();

// If this is a live stream, stop download once the audio is stopped.
if (sound._node.duration === Infinity) {
self._clearSound(sound._node);
}
}
}

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

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

return self;
},

/**
* Set the source to a 0-second silence to stop any downloading (except in IE).
* @param {Object} node Audio node to clear.
*/
_clearSound: function(node) {
var checkIE = /MSIE |Trident\//.test(Howler._navigator && Howler._navigator.userAgent);
if (!checkIE) {
node.src = 'data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA';
}
}
};

Expand Down Expand Up @@ -2479,10 +2501,10 @@
/*!
* Spatial Plugin - Adds support for stereo and 3D audio where Web Audio is supported.
*
* howler.js v2.1.1
* howler.js v2.1.2
* howlerjs.com
*
* (c) 2013-2018, James Simpson of GoldFire Studios
* (c) 2013-2019, James Simpson of GoldFire Studios
* goldfirestudios.com
*
* MIT License
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.1.1",
"version": "2.1.2",
"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.1.1
* howler.js v2.1.2
* howlerjs.com
*
* (c) 2013-2019, 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.1.1
* howler.js v2.1.2
* howlerjs.com
*
* (c) 2013-2019, James Simpson of GoldFire Studios
Expand Down

0 comments on commit 030db91

Please sign in to comment.