Click to See Complete Forum and Search --> : i need some help with this code
georgeafi
07-27-2003, 11:35 PM
I have this code to play embeded songs on my site. Right now i have a refresh button in the same frame as this code because it doesn't refresh on it own. What i am wondering is if there anything i can add to it to make it refresh on its own? This is so viewers of my site don't have to hit the refresh button when they want to hear a different song. Thanks
George
<script>
<!-- Hide from old browsers
var now=new Date();
var status=(now.getSeconds())%10;
document.write('<embed src="songs/song'+status+'.wav" height=30 width=95 autostart=true hidden=false loop="3">');
// -->
</script>
PeOfEo
07-28-2003, 12:20 AM
figure out the length of the song and then try putting this in your head
<Meta http-equiv="refresh" content="thetime;url="theurl"> That will make a page auto refresh after the set period of time. Had to hit the books for that one :) Give it a try. It worked when I tested it, Observe http://knights.europe.webmatrixhosting.net/refresh.html oh yea the time is in seconds.
georgeafi
07-28-2003, 01:43 AM
I'm sorry. I didn't make myself more clear. I have 10 different songs and a new is supposed to play when you refresh the page. I can have the player loop the same song over and over again but not play a different song when it loops, which is what i would like. I looked on afew different java sites but only found the same player i have now and not one that refreshes on its own. Sorry about the misunderstanding. Especially after you went serching for something to help me with. Thanks though.
EDIT: The songs are all different lenghs so thats why i don't think it will work.
Da Warriah
07-28-2003, 09:14 AM
you could try something like this:
<script>
<!-- Hide from old browsers
// I forget how to get a variable from the URL in JavaScript,
// but do that here, hehe
status = status;
newstatus = status+1;
// Time in seconds of each song
time[1] = "453";
time[2] = "269";
time[3] = "637";
...
time[10] = "296";
document.write('<meta http-equiv="refresh" content="'+time[status]+'; url=songs/song.html?status='+newstatus+'">');
document.write('<embed src="songs/song'+status+'.wav" height=30 width=95 autostart=true hidden=false loop="3">');
// -->
</script>
that should work, just feed the status in through the URL...Im a little rusty at JS (mostly been using PHP lately), so i kind of forget how to GET the variable from the URL, but someone should be able to help out, hehe...
PeOfEo
07-28-2003, 02:21 PM
This might be a pain but why not just redirect the user to a new page at the end of the song, Its more work but it would work.
georgeafi
07-28-2003, 09:28 PM
Ok i can try that code but thee was something else i was thinking of. Is there a way where i could have a drop box where the person could choose what song that wanted to hear? I have found code to do that but it opens up in a new window to upload then another to play it. But would there be a way to choose the song and not open a window to upload and play it in the same player that is included in the code? Sorry if i sound confusing. I want to make it as easy as pssible for the person to hear the songs.
neenach2002
07-28-2003, 09:45 PM
alternatively, you could use Links, instead of the box, and have the page reload when you click on the song...just have 10 of the same page, each with a different song in it, and when the user clicks on the songname, it will put them on the page, with the song that they wanted to hear, playing in the background...for the "10 of the same page" choose ONE to be your index page, and name the others "index2," "index 3," et cetera
PeOfEo
07-28-2003, 09:55 PM
But he wants it automated so it will work something like a play list
georgeafi
07-28-2003, 10:33 PM
Ok this is all getting to confusing. What i have right now is fine, I just wanted to try and make it a little esier to choose between songs. My last option would be this code i found for a drop down juke box but it opens the music in a new window. I would like it if I could somehow just have the music open in the same page and still have the option to choose a different song at anytime. If that isn't possible then i will most likely just stay with the way it is now.
<form>
<p align="center"><select name="s" size="1">
<option value>Juke Box</option>
<option value="1.mid">Sample 1</option>
<option value="3.mid">Sample 2</option>
<option value="2.mid">Sample 3</option>
</select></p>
<div align="center"><center><table border="0" cellpadding="3"
cellspacing="5">
<tr>
<td><input type="button" name="play"
value=" Play "
onclick="window.top.parent.location=s.options[s.selectedIndex].value"></td>
</tr>
</table>
</center></div>
</form>
PeOfEo
07-28-2003, 11:25 PM
Ever heard of internet amp lol, its on dynamic drive it streams it but you can put several songs in. http://dynamicdrive.com/dynamicindex11/midiplayer/mplayer.htm I just saw that one day and liked it lol. Its just like winamp it even has balance and volume. I dont know if you can put a wav or mp3 in but I dont see why not.
georgeafi
07-29-2003, 12:15 AM
Ok, i got the internet amp all set up and the images and files uploaded to my server but the player won't show up. Probley because it doesn't know where the files are and in the directions on how to put it together it doesn't say what to name the page you put the images in.
georgeafi
07-29-2003, 01:16 AM
I'm close to getting it working. I got it to show up and to load the songs but it won't play them. The same goes for the player that is in the link you posted. They have a sample player and i can't even get that one to work. So i am not sure whats wrong but i will work on it. Heres the link to it on my site.
http://www.miseriacantare.com/iamp/internetamp.html
PeOfEo
07-29-2003, 01:25 AM
Weird, make sure they are in the right spots, I didnt invent the thing so if its broken dont blame me :) But the one on dynamic drive work fine so I dono, you can go to the internet amp site its linked on internet amp thingy.
georgeafi
07-29-2003, 01:35 AM
Does mine work for you? Mabey its just me for some reason. Cause the one on dynamic drive does the same as mine. It says loading and when i click play it says the title of the song but it doensn't do anything.
PeOfEo
07-29-2003, 01:37 AM
dynamic drives does ur doesnt. What browser are you on.
georgeafi
07-29-2003, 01:41 AM
Internet Explorer 6
It says it works with IE 4 and up i believe.
My host is Bravenet if that matters which i doubt it would.
PeOfEo
07-29-2003, 01:49 AM
It works for me now!
PeOfEo
07-29-2003, 01:52 AM
where is the girls not grey?
georgeafi
07-29-2003, 01:53 AM
Originally posted by PeOfEo
It works for me now!
Wha wha wha??? It won't work for me. Ok this is confusing. Did you let it sit for awhile? I tried that before but it still didn't work. Hmmmmmmmmmmmmmm
georgeafi
07-29-2003, 01:55 AM
Whoa!!! You know who afi are? That cool. I haven't added that one yet. But the rest of the album except for This Celluoid Dream is on there. It still won't work for me.
PeOfEo
07-29-2003, 01:56 AM
No I just went to the page and it started playen some afi so I was like k... But why isnt girls not grey up there, thats my favorite song by them.
georgeafi
07-29-2003, 01:58 AM
I haven't added it yet. I'm going too. I still can't get it to work.
PeOfEo
07-29-2003, 02:00 AM
It works just fine yo me it just says please wait then track loading then it plays I dont do anything it just starts.
georgeafi
07-29-2003, 02:03 AM
I'll let it sit for awhile and see what it does. I have 56k so it should take afew minutes to load. Hopefully it will start working for me.
PeOfEo
07-29-2003, 02:06 AM
Bad new the whole thing doesnt load at all in mozilla and wont work in opera, this is an ie only script i guess. That isnt good. This thing seems to have some bugs in it and guess what the scripts are not on your server its remotly accessing them so you might want to ask the guy who made it for support or something.
PeOfEo
07-29-2003, 02:08 AM
I have to get up early tomorrow, but I will see if I can help you out more tomorrow, g'night.
georgeafi
07-29-2003, 02:12 AM
edit: Ok
I thought i finally had something to use. I see what i can do tomorrow i guess. Thanks for all the help though. It is much appreciated.
George