Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Paul Clapham
  • Tim Cooke
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Frank Carver
  • Henry Wong
  • Ron McLeod
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Al Hobbs
  • Piet Souris
  • Himai Minh

Java and music files - please help

Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
I have this Java script for my website and it includes playing with music files. This code selects a random song from the list, but is there any way to make this shuffle a new song after it plays the current song? I would like the music to play the random music and somehow selects a new random song to play so that it plays continuously. Please help me with this as I have no knowledge in Java, but got this code source for music files. If you can, please edit the codes for the shuffling of music files. Thanks in advance.

var sound1="theme1.wma"
var sound2="theme2.wma"
var sound3="theme3.wma"
var sound4="theme4.wma"
var sound5="theme5.wma"
var sound6="theme6.wma"
var sound7="theme7.wma"
var sound8="theme8.wma"
var sound9="theme9.wma"
var sound10="theme10.wma"
var x=Math.round(Math.random()*9)
if (x==0) x=sound1
else if (x==1) x=sound2
else if (x==2) x=sound3
else if (x==3) x=sound4
else if (x==4) x=sound5
else if (x==5) x=sound6
else if (x==6) x=sound7
else if (x==7) x=sound8
else if (x==8) x=sound9
else x=sound10
if (navigator.appName=="Microsoft Internet Explorer")
document.write('<bgsound src='+'"'+x+'"'+' loop="infinite">')
document.write('<embed src='+'"'+x+'"'+'hidden="true" border="0" width="20" height="20" autostart="true" loop="true">')
Posts: 67663
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Please do not cross-post the same question in multiple forums. It wastes people's time when multiple redundant conversations take place.
I wasn't selected to go to mars. This tiny ad got in ahead of me:
the value of filler advertising in 2021
    Bookmark Topic Watch Topic
  • New Topic