var tracklist = [{
src: 'https://primi.gg/assets/audio/gucci.mp3',
cover: 'https://i.imgur.com/Vayupax.jpg'
},
{
src: 'https://primi.gg/assets/audio/anarchyacres.mp3',
cover: 'https://i.imgur.com/Vayupax.jpg'
},
{
src: 'https://primi.gg/assets/audio/sempiternal.mp3',
cover: 'https://i.imgur.com/Vayupax.jpg'
},
{
src: 'https://primi.gg/assets/audio/wither.mp3',
cover: 'https://i.imgur.com/Vayupax.jpg'
},
{
src: 'https://primi.gg/assets/audio/enemy.mp3',
cover: 'https://i.imgur.com/Vayupax.jpg'
},
{
src: 'https://primi.gg/assets/audio/antisocial.mp3',
cover: 'https://i.imgur.com/Vayupax.jpg'
},
];
var player = false;
var track = 1;
var lastTrack = -1;
var play = function() {
if (lastTrack != track) {
player.src = tracklist[track - 1].src;
}
lastTrack = track;
if (player.paused) {
player.play();
}
};
$(document).ready(function() {
player = document.createElement('audio');
$('a.player-control').click(function(event) {
event.preventDefault();
});
$('#play').click(function() {
play();
});
$('#pause').click(function() {
if (!player.paused) {
player.pause();
}
});
$('#next').click(function() {
track++;
if (track > tracklist.length) {
track = 1;
}
play();
});
$('#prev').click(function() {
track--;
if (track < 1) {
track = tracklist.length;
}
play();
});
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<a href="#" id="prev" class="player-control">prev</a>
<a href="#" id="play" class="player-control">play</a>
<a href="#" id="pause" class="player-control">pause</a>
<a href="#" id="next" class="player-control">forward</a>
I'm basically trying to make a custom audio control with css and html, but put everything in place it doesn't work. I think it has something to do with the specific part of code "href='#'... I'm entirely new to coding so any help and pointers would be nice! Here is the entire code and thank you in advance!