Reputation:
I'm trying to get a music playlist to work in JavaScript, however I cannot get it to change songs. Here is the fiddle, if someone could tell me what I am doing wrong I would be very grateful. I am using this code for changing song:
var newSong = songs[counter];
var player = document.getElementById('audio');
player.setAttribute('src', newSong);
player.load();
player.play();
Upvotes: 0
Views: 1734
Reputation: 17366
You code works fine nothing wrong with it.
<body>
option in fiddle see screenshot below.var songs = ['http://www.tonycuffe.com/mp3/tail%20toddle.mp3', 'http://www.tonycuffe.com/mp3/cairnomount.mp3', 'http://www.tonycuffe.com/mp3/pipers%20hut.mp3'];
Upvotes: 2