Refreshing "Now Playing" on my webpage

Discuss Shoutcast streaming here, any issues, advice or tips are welcome
Forum rules
Please don't use the forums to report outages, particularly if you are a FreeStreamHosting.org user.

Refreshing "Now Playing" on my webpage

Postby markdeejay7 » Mon 16th Aug, 2010 11:05 am

Hi All,
I have an issue with the "Now Playing" JavaScript code for my stream.
I have managed to place the flash player on my webpage, as well as the "Now Playing" script on the same page (just underneath). The only issue is, the track information does not refresh itself after each track, and you need to refresh the page in order to get the track info updated. This is not ideal as it then breaks the stream of music. I have looked into placing the JS code within an "IFrame" but I am having trouble with this as well.

Any ideas please?

Regards

Mark
markdeejay7
 
Posts: 16
Joined: Sun 15th Aug, 2010 1:07 pm
Location: Glasgow - UK

Re: Refreshing "Now Playing" on my webpage

Postby markdeejay7 » Mon 16th Aug, 2010 8:04 pm

Figured this one out :D
Here is the code if anyone else is having problems with this issue..

Code to go BEFORE "/head" TAG.....
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script>
$(document).ready(function() {
$("#responsecontainer").load("now-playing.php");
var refreshId = setInterval(function() {
$("#responsecontainer").load('now-playing.php?randval='+ Math.random());
}, 30000);
});
</script>

Code to go in the "body"
<div id="responsecontainer" align="center"></div>

Also...make sure you copy the .php code from the server scripts page and save to a file (I called mine now-playing.php). This then needs to be uploaded to you web-host where the website is...(same directory)


Hope this helps :D
Mark
markdeejay7
 
Posts: 16
Joined: Sun 15th Aug, 2010 1:07 pm
Location: Glasgow - UK

Re: Refreshing "Now Playing" on my webpage

Postby Gavin » Tue 17th Aug, 2010 4:11 pm

Hi Mark, thanks for sharing your findings :) That's very useful.
Please don't PM me for support, support system located at:
Customer Support: https://secure.bellonline.co.uk/submitticket.php
FreeStreamHosting Support: http://freestreamhosting.org/support.php
Sales: https://secure.bellonline.co.uk/contact.php
Gavin
Site Admin
 
Posts: 387
Joined: Thu 01st Jan, 1970 1:00 am

Re: Refreshing "Now Playing" on my webpage

Postby WWPMMediaNet » Tue 24th Aug, 2010 1:21 am

Quick question......what would I have to do in HTML for the Now Playing if I use a free site to create my website? (I currently use Freewebs, now known as Webs.)

Suggestions?
WWPM MediaNet | Independent, Raw, No BS and Straight To The Point Internet Radio: http://www.wwpmmedianet.info
WWPMMediaNet
 
Posts: 12
Joined: Mon 23rd Aug, 2010 9:59 pm

Re: Refreshing "Now Playing" on my webpage

Postby Gavin » Tue 24th Aug, 2010 10:16 pm

If the host you use doesn't allow you to use javascript then I'd say that you're stuck for a lot of things as that limits what you can do.
Please don't PM me for support, support system located at:
Customer Support: https://secure.bellonline.co.uk/submitticket.php
FreeStreamHosting Support: http://freestreamhosting.org/support.php
Sales: https://secure.bellonline.co.uk/contact.php
Gavin
Site Admin
 
Posts: 387
Joined: Thu 01st Jan, 1970 1:00 am

Re: Refreshing "Now Playing" on my webpage

Postby WWPMMediaNet » Tue 24th Aug, 2010 10:49 pm

I'm sure I can do Javascript.....but most of the codes I have found were Javascript codes for PHP webpages
WWPM MediaNet | Independent, Raw, No BS and Straight To The Point Internet Radio: http://www.wwpmmedianet.info
WWPMMediaNet
 
Posts: 12
Joined: Mon 23rd Aug, 2010 9:59 pm

Re: Refreshing "Now Playing" on my webpage

Postby WWPMMediaNet » Tue 24th Aug, 2010 10:50 pm

Only problem is I'm unable to put one of the codes in the header. I can pretty much take care of the other one!
WWPM MediaNet | Independent, Raw, No BS and Straight To The Point Internet Radio: http://www.wwpmmedianet.info
WWPMMediaNet
 
Posts: 12
Joined: Mon 23rd Aug, 2010 9:59 pm

Re: Refreshing "Now Playing" on my webpage

Postby Gavin » Fri 27th Aug, 2010 5:00 pm

Although it's good practice to put that into the <HEAD>, it's not absolutely required and should still work if you put it into the main body.
Please don't PM me for support, support system located at:
Customer Support: https://secure.bellonline.co.uk/submitticket.php
FreeStreamHosting Support: http://freestreamhosting.org/support.php
Sales: https://secure.bellonline.co.uk/contact.php
Gavin
Site Admin
 
Posts: 387
Joined: Thu 01st Jan, 1970 1:00 am

Re: Refreshing "Now Playing" on my webpage

Postby WWPMMediaNet » Sat 28th Aug, 2010 6:40 am

What would be the procedure for someone who has their website in Flash format?
Just curious because I created one and didn't know what to do in means of the now playing.

Suggestions?
WWPM MediaNet | Independent, Raw, No BS and Straight To The Point Internet Radio: http://www.wwpmmedianet.info
WWPMMediaNet
 
Posts: 12
Joined: Mon 23rd Aug, 2010 9:59 pm

Re: Refreshing "Now Playing" on my webpage

Postby Ferik » Sun 05th Sep, 2010 2:02 am

this simple code refresh id or class only not all page, comodo.

in <head> section:

Code: Select all
<!-- necessary jquery -->
<script type="text/javascript" src="jquery.min.js"></script>

<!-- start code -->
<script type="text/javascript">
   function refNowPlaying() {
     $("#nowPlaying").load(window.location.href + "#nowPlaying");
     return false;
    }
  $(document).ready(function () { setInterval("refNowPlaying()", 15000); }); // 15 seconds
 </script>
<!-- end code -->


in <body> section:

Code: Select all
 
<div id="radioStatsNow">
<h3>NOW PLAYNG</h3>
<!--YOUR STATS CODE - refresh your statistcs every 15 seconds-->
</div>


Bye :)
Ferik
 
Posts: 11
Joined: Thu 14th Jan, 2010 11:37 am

Re: Refreshing "Now Playing" on my webpage

Postby wingman » Mon 06th Sep, 2010 5:33 pm

Im new here, but ive got my stream up and running on my site, got the player working, and of course the ads (small price to pay for such a brilliant service)... Everything that should work is working properly. apart from this now playing track thing. its driving me barmy trying to sort it...
The problem is, my web site is a sprutz (not a free one though) but i cant get to the web site server files to add code, although ive tried the code posted here, and the page seems to refresh silently (so to speak) i still cant get the song to update without manually refreshing the page, which as we know, isnt good, and something that listeners wont do anyway..

Any suggestion while i still have some hair left to pull out :wink:
wingman
 
Posts: 30
Joined: Mon 06th Sep, 2010 5:17 pm
Location: south yorkshire UK

Re: Refreshing "Now Playing" on my webpage

Postby Orions_Radio » Fri 10th Sep, 2010 2:57 pm

sounds to me like you may be having a cache problem when updating .. you can try this simple code to refresh instead.... (this can be added anywhere in the body tag)

Code: Select all
<?php
 $refreshURL = "testrefresh.php?buster=".date('dhis').rand(1,1000); //replace testrefresh.php with your file name
 $timeout = "30"   //Time in seconds for refresh
 ?>
 <SCRIPT LANGUAGE="JavaScript">
<!---
 var refreshID = "";
 refreshID = setTimeout("DoRefresh()", <?php echo ($timeout*1000); ?>);

function DoRefresh()
{
  document.location.href = '<?php echo $refreshURL; ?>';
}
//--->
</SCRIPT>


This code will refresh your page giving at a unique number each refresh which should bypass any caching of pages

*Note* this doesn't seem to work with html pages but if you want to use this code on an html page.... simply rename the page to a php extension

Example: if your file is called radio.html ... rename it to radio.php and change testrefresh.php to radio.php
The page should look the same whether it has a html or php extension.

Hope this helps
Orions_Radio
 
Posts: 9
Joined: Fri 10th Sep, 2010 1:15 pm

Re: Refreshing "Now Playing" on my webpage

Postby Orions_Radio » Fri 10th Sep, 2010 3:15 pm

here is the code rewritten for html if you prefer to keep the page html

Code: Select all
<SCRIPT LANGUAGE="JavaScript">
<!---
 var refreshID = "";
 var timeout = "30";
 refreshID = setTimeout("DoRefresh()", (timeout*1000));

function DoRefresh()
{
  var buster = Math.random();
  document.location.href = 'testrefresh.html?buster='+buster;
}
//--->
</SCRIPT>


of course timeout is the time in seconds of refresh and you need to replace testrefresh.html with your html file
Orions_Radio
 
Posts: 9
Joined: Fri 10th Sep, 2010 1:15 pm

Re: Refreshing "Now Playing" on my webpage

Postby z neumann » Sun 12th Sep, 2010 2:20 am

Here is a easy way you can do it using an <iframe> method open an html editor for example Ace Html create a new html file. Here is the code you will want to enter. <html/>"then your song title code goes here"<p>"enter a refresh script here I recommend this one http://www.dynamicdrive.com/dynamicindex6/refresh.htm"<html/> save this file as nowplaying.html upload this file to your web host server. Now on the page your radio is on you will enter this <iframe>
<iframe height="90" width="336" frameborder="0" src="http://yoursitehere/nowplaying.html"></iframe>
Hope this helps you! :mrgreen:
z neumann
 
Posts: 1
Joined: Sun 12th Sep, 2010 2:10 am

Re: Refreshing "Now Playing" on my webpage

Postby WWPMMediaNet » Thu 16th Sep, 2010 10:28 pm

z neumann, thanks for the help.....

now, I want to setup a list that includes the five previous songs with two buttons per song: one for Lyrics (opening in a new tab) and one for Buy (opening in a new tab).

Can any of you guys help with that? It would be well appreciated!
WWPM MediaNet | Independent, Raw, No BS and Straight To The Point Internet Radio: http://www.wwpmmedianet.info
WWPMMediaNet
 
Posts: 12
Joined: Mon 23rd Aug, 2010 9:59 pm

Next

Return to Streaming Discussion

 


  • Related topics
    Replies
    Views
    Last post

Who is online

Users browsing this forum: Google [Bot] and 1 guest