samedi 30 juin 2018

Why does this playlist code work fine on only about half the browsers/platforms/html test sites?

I have tested this code on three different test sites using three different browsers on two different MacOS versions. It works perfect on some and not at all on the others. I even tried an alternate manual playlist code wizard using SCM Player at https://scmplayer.co/ but the embed code that produced works nowhere. Anyway, here is the code that works half the time (placed within the tags). Any help would be greatly appreciated!

<script type="text/javascript">
var numberOfSongs = 26
var sound = new Array(numberOfSongs+1)
sound[0]= "http://rvratptcavailability.x10host.com/afhsclassof1986/highschoolflashbacksongs/Rio.mp3"
sound[1]= "http://rvratptcavailability.x10host.com/afhsclassof1986/highschoolflashbacksongs/Alive%20And%20Kicking.mp3"
sound[2]= "http://rvratptcavailability.x10host.com/afhsclassof1986/highschoolflashbacksongs/Key%20Largo.mp3"
sound[3]= "http://rvratptcavailability.x10host.com/afhsclassof1986/highschoolflashbacksongs/Come%20On%20Eileen.mp3"
sound[4]= "http://rvratptcavailability.x10host.com/afhsclassof1986/highschoolflashbacksongs/Tainted%20Love.mp3"
sound[5]= "http://rvratptcavailability.x10host.com/afhsclassof1986/highschoolflashbacksongs/Everybody%20Wants%20You.mp3"
sound[6]= "http://rvratptcavailability.x10host.com/afhsclassof1986/highschoolflashbacksongs/Eyes%20Without%20A%20Face.mp3"
sound[7]= "http://rvratptcavailability.x10host.com/afhsclassof1986/highschoolflashbacksongs/Hungry%20Like%20The%20Wolf.mp3"
sound[8]= "http://rvratptcavailability.x10host.com/afhsclassof1986/highschoolflashbacksongs/I%20Ran%20%28So%20Far%20Away%29.mp3"
sound[9]= "http://rvratptcavailability.x10host.com/afhsclassof1986/highschoolflashbacksongs/If%20I%27d%20Been%20The%20One.m4a"
sound[10]= "http://rvratptcavailability.x10host.com/afhsclassof1986/highschoolflashbacksongs/It%27s%20My%20Life%20%5BTalk%20Talk%5D.mp3"
sound[11]= "http://rvratptcavailability.x10host.com/afhsclassof1986/highschoolflashbacksongs/Let%27s%20Go%20%5BWang%20Chung%5D.mp3"
sound[12]= "http://rvratptcavailability.x10host.com/afhsclassof1986/highschoolflashbacksongs/Obsession.mp3"
sound[13]= "http://rvratptcavailability.x10host.com/afhsclassof1986/highschoolflashbacksongs/On%20The%20Dark%20Side.mp3"
sound[14]= "http://rvratptcavailability.x10host.com/afhsclassof1986/highschoolflashbacksongs/The%20Other%20Guy.mp3"
sound[15]= "http://rvratptcavailability.x10host.com/afhsclassof1986/highschoolflashbacksongs/Promises%20Promises.mp3"
sound[16]= "http://rvratptcavailability.x10host.com/afhsclassof1986/highschoolflashbacksongs/Rock%20Me%20Amadeus.mp3"
sound[17]= "http://rvratptcavailability.x10host.com/afhsclassof1986/highschoolflashbacksongs/The%20Safety%20Dance.mp3"
sound[18]= "http://rvratptcavailability.x10host.com/afhsclassof1986/highschoolflashbacksongs/She%27s%20A%20Beauty.mp3"
sound[19]= "http://rvratptcavailability.x10host.com/afhsclassof1986/highschoolflashbacksongs/Somebody%27s%20Baby.m4a"
sound[20]= "http://rvratptcavailability.x10host.com/afhsclassof1986/highschoolflashbacksongs/Someday%20%5BGlass%20Tiger%5D.mp3"
sound[21]= "http://rvratptcavailability.x10host.com/afhsclassof1986/highschoolflashbacksongs/Vacation.m4a"
sound[22]= "http://rvratptcavailability.x10host.com/afhsclassof1986/highschoolflashbacksongs/Whisper%20To%20A%20Scream%20%28Birds%20Fly%29.mp3"
sound[23]= "http://rvratptcavailability.x10host.com/afhsclassof1986/highschoolflashbacksongs/What%20Is%20Love_.mp3"
sound[24]= "http://rvratptcavailability.x10host.com/afhsclassof1986/highschoolflashbacksongs/Take%20It%20Easy%20On%20Me.mp3"
sound[25]= "http://rvratptcavailability.x10host.com/afhsclassof1986/highschoolflashbacksongs/The%20Old%20Man%20Down%20The%20Road.mp3"
function randomNumber(){
var randomLooper = -1
while (randomLooper < 0 || randomLooper > numberOfSongs ||isNaN(randomLooper)){    randomLooper = parseInt(Math.random()*(numberOfSongs+1))
}
return randomLooper
}
var randomsub = randomNumber()
var soundFile = sound[randomsub]
document.write ('<EMBED src= "' + soundFile + '" hidden=true  type="audio/mpeg" autostart=true loop=true>')
</script>

Here is a link to the web page to see if works (plays music) on your browser or platform; maybe you can extract the code from there if necessary: http://rvratptcavailability.x10host.com/afhsclassof1986/




Aucun commentaire:

Enregistrer un commentaire