473,396 Members | 1,990 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Play the next track when the current one finishes.

Hey guys, i'm currently doing a website that required random background music. But now im facing a problem where how can i modify my current script so that it will auto play the next track instead of looping the current track? Im kinda new to this. thanks in advance =)

These are my codes:

Expand|Select|Wrap|Line Numbers
  1. var sound1="sounds/2001spce.mid"
  2. var sound2="sounds/20fox.mid"
  3. var sound3="sounds/9010v2.mid"
  4. var sound4="sounds/adam.mid"
  5. var sound5="sounds/apollo13.mid"
  6. var sound6="sounds/airwolf.mid"
  7. var sound7="sounds/btfuture.mid"
  8. var sound8="sounds/baywatch.mid"
  9. var sound9="sounds/chicagobull.mid"
  10. var sound10="sounds/xfile.mid"
  11. var x=Math.round(Math.random()*9)
  12. if (x==0) x=sound1
  13. else if (x==1) x=sound2
  14. else if (x==2) x=sound3
  15. else if (x==3) x=sound4
  16. else if (x==4) x=sound5
  17. else if (x==5) x=sound6
  18. else if (x==6) x=sound7
  19. else if (x==7) x=sound8
  20. else if (x==8) x=sound9
  21. else x=sound10
  22.  
  23. if (navigator.appName=="Microsoft Internet Explorer")
  24. document.write('<bgsound src='+'"'+x+'"'+' loop="infinite">')
  25. else 
  26. document.write('<embed src='+'"'+x+'"'+'hidden="true" border="0" width="20" height="20" autostart="true" loop="true">')
Aug 28 '07 #1
4 1508
acoder
16,027 Expert Mod 8TB
You should use the object element. See Playing Sounds in the Browser.

See links on using with QuickTime and Real.

Please use CODE tags when posting code. Thanks!
Aug 28 '07 #2
pbmods
5,821 Expert 4TB
Heya, Elusified. Welcome (back) to TSDN!

Changed thread title to better describe the problem (did you know that threads whose titles that do not follow the Posting Guidelines actually get FEWER responses?).
Aug 28 '07 #3
gees. ok thx guys =)! i'll try it out. hehe n will take note of my topic da next time ya. Cheers!
Aug 29 '07 #4
hmmm. after much research on the web about <objects>, i still have no idea how to go about doing this function. Need some examples to get me started, anyone got good examples to share? thanks alot.
Aug 29 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: jassan | last post by:
Does anybody know how to modify the following so that it does a random play from the .rpm file? <!-- --><embed SRC="http://your-url.rpm" type="audio/x-pn-realaudio-plugin" CONTROLS="Control"...
2
by: Sandman | last post by:
Just looking for suggestion on how to do this in my Web application. The goal is to keep track of what a user has and hasn't read and present him or her with new material I am currently doing...
5
by: Dennis C. Drumm | last post by:
I have a windows form configured as a fixed dialog I'm using as a custom MessageBox (has some additional buttons). How do I get it to play the standard windows sounds when envoked and can I insert...
1
by: Lam | last post by:
how can I play sound file in a .aspx page written in C#? I try to use the code like the following. But whenI call the play function play("sound.wav", this.SND_ASYNC) my computer give out "be"...
4
by: ted.j.conway | last post by:
Seems like it should be so simple, but how does one play a .wav file and then another upon its completion (and a third after that and...), WITHOUT using HTML+TIME? Any code examples - IE and/or...
1
by: chitara | last post by:
code.poet Group: Members Joined: 16 Dec, 2005 Posts: 64 My Contributions
27
by: Frederick Gotham | last post by:
I thought it might be interesting to share experiences of tracking down a subtle or mysterious bug. I myself haven't much experience with tracking down bugs, but there's one in particular which...
7
by: wqmmnm | last post by:
How do I create an html list using php and mysql that also has the previous and next funtionality.
2
by: W. Watson | last post by:
How difficult would it be to write a Python program that would play a specific track on a CD from say 8 am to 6 pm each weekday on a PC's speaker, and switch tracks each day? That is, what library...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.