Moved html5 error listener to MusesPlayer constructor

This commit is contained in:
drigato 2015-03-31 17:20:42 -04:00
parent 778df97d3c
commit 15a8e3fa1f
1 changed files with 10 additions and 7 deletions

View File

@ -39,6 +39,16 @@
$("p.station_name").html("<?php echo $this->station_name?>");
getMetadata();
// detects errors in HTML5 mode
if (!this.flashDetect) {
MRP.html.audio.addEventListener('error', function failed(e) {
var stream = musesPlayer.getNextAvailableStream();
console.log(stream);
MRP.html.audio.src = stream["url"];
MRP.html.audio.play();
}, true);
}
};
MusesPlayer.prototype.mobileDetect = function() {
@ -120,13 +130,6 @@
MRP.html.audio.src = MRP.html.src;
MRP.html.audio.play();
// detects errors in HTML5 mode
MRP.html.audio.addEventListener('error', function failed(e) {
var stream = musesPlayer.getNextAvailableStream();
MRP.html.audio.src = stream["url"];
MRP.html.audio.play();
}, true);
}
function musesHTMLStopClick() {