Non-Subspace Related Coding - song length (php/javascript) BDwinsAlt - Sun Nov 12, 2006 2:19 pm Post subject: song length (php/javascript)
Does anyone know how to detect how long a song will last or when a song is done playing in javascript or php.
I have this thing that plays a random song, I made it by naming songs 1.mp3, 2.mp3 ect and just generating a random number.
What I need it to do now is after it plays that one song, refresh the window so it plays a new song. That's why I need to know either how to calculate the song length or actually see when it is done playing.
EDIT: Nevermind, I figured out a different way.
Since I had if statements to show which song was playing I just added how long the song lasted in seconds then made the page refresh for that time period.
if ($random == 1){
echo('<br />Current Song: DJ Baby Anne - 2001');
echo('<meta http-equiv="refresh" content="206;url=music.php">');
}
One down, 63 songs to go.
Smong - Mon Nov 13, 2006 12:07 pm Post subject:
Why not generate a playlist file, serve it as a content attachment and have whatever media player the user has installed play it.
Mine GO BOOM - Mon Nov 13, 2006 12:18 pm Post subject:
I'd look into a bunch of the different AJAX toolkits. Lots of different features there, such as the ability to push new music or to just stream chunks of music, where the chunks just come progressively from one mp3 file and then change to another when that is done.
I think I've seen this in a flash version too, but I doubt that would be as simple to learn.
Anonymous - Mon Nov 13, 2006 4:52 pm Post subject:
I made a new song link, it refreshes the page since each some is randomly played each time music.php is visited. It basically just streams each song and then once it is done it plays another one.
You can check out the other stuff there, its our alias bot. I made it so I could alias anyone or check out who banned who and why from any computer without having to download continuum. It's just a logicbot, mysql server, and some fun.
Let me know if you find any security holes or make any suggestions.
Cyan~Fire - Mon Nov 13, 2006 6:29 pm Post subject:
I think smong had the best idea.
BDwinsAlt - Mon Nov 13, 2006 7:01 pm Post subject:
I had issues with that. In IE it uses windows media, but in firefox it uses quick time. I could get the playlist to play in IE but not Firefox. I'm doing this so that every browser (besides opera since it plays the same song over and over) can listen. Can the playlist be set to be shuffled? I like them to just be random.
Maverick - Tue Nov 14, 2006 3:09 am Post subject:
That firefox uses quicktime is caused by your own settings, bd.
BDwinsAlt - Tue Nov 14, 2006 7:43 am Post subject:
Ok, they are default settings. Am I the only one who will have those setts? No. I said I was trying to make it work for everyone.
It works fine for Firefox and IE users. So I'm not worried about the other people.
D1st0rt - Fri Nov 17, 2006 1:41 am Post subject:
Is song length stored in the ID3 tags?