I'm not being able to ...I'm not being able to make a playlist. I need to play an alternative radio when our shoutcast radio is off.
If i write the xml putting the alternative radio first, it sounds. But if i write it second, and my radio is not streaming, then it just doesn't play.
This is the file:
<?xml version='1.0' encoding='UTF-8'?>
<playlist version="1" xmlns="http://xspf.org/ns/0/" xmlns:jwplayer="http://developer.longtailvideo.com/trac/wiki/FlashFormats">
<trackList>
<track>
<creator>
ASTARBAGUS
</creator>
<title>
ASTARBAGUS - The Asian Touch
</title>
<location>
http://astarbagus.no-ip.biz:8000/;*.nsv
</location>
<info>astarbagus@hotmail.com</info>
<image>
http://www.astarbagus.com.ar/images/logo.png
</image>
<jwplayer:type>
sound
</jwplayer:type>
<jwplayer:duration>
14400
</jwplayer:duration>
</track>
<track>
<title>Libasoles radio</title>
<location>http://libasoles.no-ip.biz:8000/;*.nsv
</location>
<info>Prueba de emision</info>
<jwplayer:type>
sound
</jwplayer:type>
<jwplayer:duration>
-1
</jwplayer:duration>
</track>
</trackList>
</playlist>
You can use a bit of JavaScript to switch streams if the stream can't connect.
<script type="text/javascript">var player = null;
var playlist = null;
var currentTime = 0;
var previousTime = -1;
function playerReady(obj)
{
player = gid(obj.id);
addListeners();
};
function addListeners()
{
playlist = player.getPlaylist();
if(playlist.length > 0)
{
player.addModelListener('TIME', 'timeMonitor');
checkTime();
}
else
{
setTimeout("addListeners();", 50);
}
};
function timeMonitor(obj)
{
currentTime = obj.position
};
function checkTime()
{
if(previousTime < currentTime)
{
previousTime = currentTime;
}
else
{
player.sendEvent('NEXT');
alert('Switching Streams');
}
setTimeout("checkTime();", 30000);
};
function gid(name)
{
return document.getElementById(name);
};
</script>