HTML5 audio stop buffering
Completely stop audio buffering. This is an good solution for radio streaming and also for hybrid mobile applications using Cordova, Ionic etc.
HTML
<button onclick='play()'>Play</button>
<button onclick='pause()'>Pause</button>
JavaScript
var url = 'http://streaming.tdiradio.com:8000/house.mp3'
var stream = new Audio(url);
stream.preload = 'none';
play = () => {
stream.play();
}
pause = () => {
stream.pause();
stream.src = ''
stream.load();
stream = null;
stream = new Audio();
stream.src = url;
stream.preload = 'none';
stream.pause();
}