I stream webradio mpeg with MediaElement.js via shoutcast and it works. but when i click the stop button, the player stops not really, but it buffers the music. How can I stop the player permanently? can someone help me?
1 Answers
0
votes
Browsers manage media buffering differently so it's very hard to stop buffering consistently.
Apart from setting preload="none"
in your video/audio
tag(s), a trick that would work in most browsers is to (re)load the media if this is stopped.
You could add an event
listener and trigger the media reload if stopped (MEJS only includes the pause
event, which seamlessly work) like :
$("audio").mediaelementplayer({
success: function (mediaElement, domObject) {
mediaElement.addEventListener('pause', function (e) {
mediaElement.load();
}, false);
}
});
See JSFIDDLE
Note: this is a workaround that may not work in all browsers.