have a list, in which the names of the songs I want to play are placed in an order…when i have to play the next one, my function gets the currently playing song’s index, and plays the next one in the list..
toPlay = autoPlayOrder[(autoPlayOrder.indexOf(playing)) + 1]
play(toPlay)
here,
autoPlayOrder
is the list which has the songs to playplaying
is the song which is currently playingplay()
is a function I have that just plays the song
Now the system works as expected when the page is loaded but when im on another webpage, then when the song stops the next one isnt autoplayed…im guessing this is due to the reason that javascript isnt allowed to run when the page is not active
Just another side note, I was almost facing the same issue when i tried to make a loop song feature, but managed to work around that by using the inbuilt loop
feature in an audio
element in html..
Thanks!