|
938 | 938 | }
|
939 | 939 | };
|
940 | 940 |
|
| 941 | + // If this is streaming audio, make sure the src is set and load again. |
| 942 | + if (node.src === 'data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA') { |
| 943 | + node.src = self._src; |
| 944 | + node.load(); |
| 945 | + } |
| 946 | + |
941 | 947 | // Play immediately if ready, or wait for the 'canplaythrough'e vent.
|
942 | 948 | var loadedNoReadyState = (window && window.ejecta) || (!node.readyState && Howler._navigator.isCocoonJS);
|
943 | 949 | if (node.readyState >= 3 || loadedNoReadyState) {
|
|
1088 | 1094 | } else if (!isNaN(sound._node.duration) || sound._node.duration === Infinity) {
|
1089 | 1095 | sound._node.currentTime = sound._start || 0;
|
1090 | 1096 | sound._node.pause();
|
| 1097 | + |
| 1098 | + // If this is a live stream, stop download once the audio is stopped. |
| 1099 | + if (sound._node.duration === Infinity) { |
| 1100 | + self._clearSound(sound._node); |
| 1101 | + } |
1091 | 1102 | }
|
1092 | 1103 | }
|
1093 | 1104 |
|
|
1703 | 1714 | // Remove the source or disconnect.
|
1704 | 1715 | if (!self._webAudio) {
|
1705 | 1716 | // Set the source to 0-second silence to stop any downloading (except in IE).
|
1706 |
| - var checkIE = /MSIE |Trident\//.test(Howler._navigator && Howler._navigator.userAgent); |
1707 |
| - if (!checkIE) { |
1708 |
| - sounds[i]._node.src = 'data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA'; |
1709 |
| - } |
| 1717 | + self._clearSound(sounds[i]._node); |
1710 | 1718 |
|
1711 | 1719 | // Remove any event listeners.
|
1712 | 1720 | sounds[i]._node.removeEventListener('error', sounds[i]._errorFn, false);
|
|
2124 | 2132 | node.bufferSource = null;
|
2125 | 2133 |
|
2126 | 2134 | return self;
|
| 2135 | + }, |
| 2136 | + |
| 2137 | + /** |
| 2138 | + * Set the source to a 0-second silence to stop any downloading (except in IE). |
| 2139 | + * @param {Object} node Audio node to clear. |
| 2140 | + */ |
| 2141 | + _clearSound: function(node) { |
| 2142 | + var checkIE = /MSIE |Trident\//.test(Howler._navigator && Howler._navigator.userAgent); |
| 2143 | + if (!checkIE) { |
| 2144 | + node.src = 'data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA'; |
| 2145 | + } |
2127 | 2146 | }
|
2128 | 2147 | };
|
2129 | 2148 |
|
|
0 commit comments