I think I might be able to assist you here - but at the end of my post I have a question maybe someone can help me with -
I created a separate file to pull the playing info. Now this is for shoutcast, so I'm not sure if you are using that or icecast. I would have to dig around to find the write syntax for icecast - but here you go for shoutcast -
within your player, create an iframe <iframe> code </iframe>
Call you php file inside the iframe -
I call mine playing.php and also associated a separate css file as I also pull in album art - You'll want to remove the album include from your code.
code:
=============================================================
<?php
include_once("get_album_art.php");
$sc_url_ip = "
your_url.com"; // <= CHANGE THIS//ex: 6x.3x.18x.14x
$sc_url_port = "9014"; // <= CHANGE THIS//
function getNowPlaying($sc_url_ip,$sc_url_port)
{
$open = fsockopen($sc_url_ip,$sc_url_port,$errno,$errstr,'.5');
if ($open)
{
fputs($open,"GET /7.html HTTP/1.1\nUser-Agent:Mozilla\n\n");
stream_set_timeout($open,'1');
$read = fread($open,200);
$text = explode(",",$read);
if($text[6] == '' || $text[6] == '</body></html>'){ $msg = ' live stream '; }
else { $msg = $text[6]; }
$text = ' '.$msg;
}
else { return false; }
fclose($open);
return $text;
}
$current_song = getNowPlaying($sc_url_ip,$sc_url_port);
list($artist,$title) = explode(" - ",$current_song);
$image = GetAlbumArtFromAmazon($artist,'');
?>
<html>
<head>
<link href="css/player.css" rel="stylesheet" type="text/css" />
<!--[if lt IE 8]>
<link href="css/ie8.css" rel="stylesheet" type="text/css" />
<![endif]-->
</head>
<body>
<div id="logo"><img src="images/logo.png" width="172" height="90" alt="My Station"> </div>
<div id="image"><?php if ($image) { echo '<img src="'.$image.'">'; } ?></div>
<div id="now_playing"><?php print $current_song; ?></div>
<br />
</div>
</body>
</html
===================================================
I also add the following to update the playing info within intervals (60 seconds here). I know there is a more elegant way to do this, but I wrote this ages ago, and haven't gotten around to doing it with ajax -
code in your header of your index file
=========================================
<script>
function updatePlaying() {
$.get("playing.php", function(data) {
$("#playing").html(data);
window.setTimeout(updatePlaying, 60000);
});
}
updatePlaying();
</script>
===================================================
Now I create a <div> within my html where I want the playing info to be displayed and the size of the iframe:
code
=======================================================
<div id="playing"><iframe src="playing.php" width="260" height="50" frameborder="0" scrolling="no"></iframe></div>
=============================================================================================
Now I have a small problem with the css on my player - I'm currently using the pink flag template that I modified, and I'm trying to scoot the controls up a bit and changes I make seem to make a mess of the controls. Anyone tell me which div within the template's css will do this? I need to move the control (start/pause) up about maybe 5px from where they are so the player fits better on the mobile devices as that is what I've set this up for. Any help would be really appreciated.
Ruth