Skip to content

Commit 4ebd189

Browse files
committed
v2.0.3
1 parent f5f5edc commit 4ebd189

8 files changed

+47
-33
lines changed

CHANGELOG.md

+9
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
## 2.0.3 (March 11, 2017)
2+
- `CHANGED` Unloading a sound no longer fires the `end` event ([#675](https://github.com/goldfire/howler.js/pull/675)).
3+
- `FIXED` Remove `setTimeout` wrapper on HTML5 `play` call to fix issues on mobile browsers ([#694](https://github.com/goldfire/howler.js/pull/694)).
4+
- `FIXED` Remove rare possibility of duplicate sound ID's by using global counter ([#709](https://github.com/goldfire/howler.js/issues/709)).
5+
- `FIXED` Support fades with 2+ decmial places ([#696](https://github.com/goldfire/howler.js/issues/696)).
6+
- `FIXED` Error in Firefox caused by invalid silent WAV on `unload` ([#678](https://github.com/goldfire/howler.js/issues/678)).
7+
- `FIXED` Check for and warn about missing file extension ([#680](https://github.com/goldfire/howler.js/issues/680)).
8+
- `FIXED` Regression in Firefox relating to spatial audio ([#664](https://github.com/goldfire/howler.js/issues/664)).
9+
110
## 2.0.2 (December 4, 2016)
211
- `FIXED` Wait to begin playback until AudioContext has resumed ([#643](https://github.com/goldfire/howler.js/issues/643)).
312
- `FIXED` Run `noAudio` check on initial setup instead of waiting for first `Howl` ([#619](https://github.com/goldfire/howler.js/issues/619)).

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

+28-23
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/*!
2-
* howler.js v2.0.2
2+
* howler.js v2.0.3
33
* howlerjs.com
44
*
5-
* (c) 2013-2016, James Simpson of GoldFire Studios
5+
* (c) 2013-2017, James Simpson of GoldFire Studios
66
* goldfirestudios.com
77
*
88
* MIT License
@@ -30,6 +30,9 @@
3030
init: function() {
3131
var self = this || Howler;
3232

33+
// Create a global ID counter.
34+
self._counter = 0;
35+
3336
// Internal properties.
3437
self._codecs = {};
3538
self._howls = [];
@@ -559,8 +562,13 @@
559562
}
560563
}
561564

565+
// Log a warning if no extension was found.
566+
if (!ext) {
567+
console.warn('No file extension was found. Consider using the "format" property or specify an extension.');
568+
}
569+
562570
// Check if this extension is available.
563-
if (Howler.codecs(ext)) {
571+
if (ext && Howler.codecs(ext)) {
564572
url = self._src[i];
565573
break;
566574
}
@@ -723,7 +731,8 @@
723731
playWebAudio();
724732
} else {
725733
// Wait for the audio to load and then begin playback.
726-
self.once(isRunning ? 'load' : 'resume', playWebAudio, isRunning ? sound._id : null);
734+
var event = !isRunning && self._state === 'loaded' ? 'resume' : 'load';
735+
self.once(event, playWebAudio, isRunning ? sound._id : null);
727736

728737
// Cancel the end timer.
729738
self._clearTimer(sound._id);
@@ -735,19 +744,16 @@
735744
node.muted = sound._muted || self._muted || Howler._muted || node.muted;
736745
node.volume = sound._volume * Howler.volume();
737746
node.playbackRate = sound._rate;
747+
node.play();
738748

739-
setTimeout(function() {
740-
node.play();
741-
742-
// Setup the new end timer.
743-
if (timeout !== Infinity) {
744-
self._endTimers[sound._id] = setTimeout(self._ended.bind(self, sound), timeout);
745-
}
749+
// Setup the new end timer.
750+
if (timeout !== Infinity) {
751+
self._endTimers[sound._id] = setTimeout(self._ended.bind(self, sound), timeout);
752+
}
746753

747-
if (!internal) {
748-
self._emit('play', sound._id);
749-
}
750-
}, 0);
754+
if (!internal) {
755+
self._emit('play', sound._id);
756+
}
751757
};
752758

753759
// Play immediately if ready, or wait for the 'canplaythrough'e vent.
@@ -1135,10 +1141,10 @@
11351141
}
11361142

11371143
// When the fade is complete, stop it and fire event.
1138-
if (vol === to) {
1144+
if ((to < from && vol <= to) || (to > from && vol >= to)) {
11391145
clearInterval(sound._interval);
11401146
sound._interval = null;
1141-
self.volume(vol, soundId);
1147+
self.volume(to, soundId);
11421148
self._emit('fade', soundId);
11431149
}
11441150
}.bind(self, ids[i], sound), stepLen);
@@ -1468,13 +1474,12 @@
14681474
// Stop the sound if it is currently playing.
14691475
if (!sounds[i]._paused) {
14701476
self.stop(sounds[i]._id);
1471-
self._emit('end', sounds[i]._id);
14721477
}
14731478

14741479
// Remove the source or disconnect.
14751480
if (!self._webAudio) {
14761481
// Set the source to 0-second silence to stop any downloading.
1477-
sounds[i]._node.src = 'data:audio/wav;base64,UklGRiQAAABXQVZFZm10IBAAAAABAAEARKwAAIhYAQACABAAZGF0YQAAAAA=';
1482+
sounds[i]._node.src = 'data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA';
14781483

14791484
// Remove any event listeners.
14801485
sounds[i]._node.removeEventListener('error', sounds[i]._errorFn, false);
@@ -1890,7 +1895,7 @@
18901895
self._sprite = '__default';
18911896

18921897
// Generate a unique ID for this sound.
1893-
self._id = Math.round(Date.now() * Math.random());
1898+
self._id = ++Howler._counter;
18941899

18951900
// Add itself to the parent's pool.
18961901
parent._sounds.push(self);
@@ -1960,7 +1965,7 @@
19601965
self._sprite = '__default';
19611966

19621967
// Generate a new ID so that it isn't confused with the previous sound.
1963-
self._id = Math.round(Date.now() * Math.random());
1968+
self._id = ++Howler._counter;
19641969

19651970
return self;
19661971
},
@@ -2192,10 +2197,10 @@
21922197
/*!
21932198
* Spatial Plugin - Adds support for stereo and 3D audio where Web Audio is supported.
21942199
*
2195-
* howler.js v2.0.2
2200+
* howler.js v2.0.3
21962201
* howlerjs.com
21972202
*
2198-
* (c) 2013-2016, James Simpson of GoldFire Studios
2203+
* (c) 2013-2017, James Simpson of GoldFire Studios
21992204
* goldfirestudios.com
22002205
*
22012206
* MIT License

dist/howler.min.js

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

dist/howler.spatial.min.js

+2-2
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
@@ -28,7 +28,7 @@
2828
"uglify-js": "2.x"
2929
},
3030
"main": "dist/howler.js",
31-
"version": "2.0.2",
31+
"version": "2.0.3",
3232
"license": {
3333
"type": "MIT",
3434
"url": "https://raw.githubusercontent.com/goldfire/howler.js/master/LICENSE.md"

src/howler.core.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*!
2-
* howler.js v2.0.2
2+
* howler.js v2.0.3
33
* howlerjs.com
44
*
55
* (c) 2013-2017, 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.0.2
4+
* howler.js v2.0.3
55
* howlerjs.com
66
*
77
* (c) 2013-2017, James Simpson of GoldFire Studios

0 commit comments

Comments
 (0)