I have been working on a website for something that would have a javascript based ShoutCast radio player. Here is the code that would be on each page's index file.
<!-- BEGINS: AUTO-GENERATED MUSES RADIO PLAYER CODE -->
<script type="text/javascript" src="https://hosted.muses.org/mrp.js"></script>
<script type="text/javascript">
MRP.insert({
'url':'Example.radiolink.com',
'codec':'mp3',
'volume':100,
'autoplay':false,
'buffering':5,
'title':'Example',
'welcome':'Test',
'bgcolor':'#FFFFFF',
'skin':'mcclean',
'width':180,
'height':60
});
</script>
<!-- ENDS: AUTO-GENERATED MUSES RADIO PLAYER CODE -->
How could I make it so this could remain playing while browsing each seperate php/html file. For example, currently if you switch page, while loading the player will pause for a few seconds and then continue after the next page loads. I have seen a few websites have this working without running off a single index file. I was wondering how to do this.
Thanks in advance, Kevin.
Simple answer - you can't. When the user leaves the page, the script is stopped.
However, there's ways to work around that - some ideas:
Note - you can change URL in the browser nav bar using the History API - so people will feel like they go to different page and can eg. bookmark it, while really staying on the same one.