
Var s = parseInt(audio.currentTime % 60) I had attached the code:Īudio.volume = parseFloat(this.value / 10)
Html5 audio player with playlist code#
Now we are going to add code for volume control and time duration in your main.js file.Main.js: var audio = new Audio('media/Linkin Park - Papercut.mp3') Now, we are going to add three buttons to our application using JavaScript for which you will need to go to your js folder and open the main.js file and add the following code:.Steps for creating Play, Pause & Stop buttons: Open that file and add the following code:īackground: -moz-linear-gradient(left, #78284a 0%, #6d8a9f 100%) /* FF3.6+ */īackground: -webkit-gradient(linear, left top, right top, color-stop(0%,#78284a), color-stop(100%,#6d8a9f)) /* Chrome,Safari4+ */īackground: -webkit-linear-gradient(left, #78284a 0%,#6d8a9f 100%) /* Chrome10+,Safari5.1+ */īackground: -o-linear-gradient(left, #78284a 0%,#6d8a9f 100%) /* Opera 11.10+ */īackground: -ms-linear-gradient(left, #78284a 0%,#6d8a9f 100%) /* IE10+ */īackground: linear-gradient(to right, #78284a 0%,#6d8a9f 100%) /* W3C */īackground:url(./images/knob.png) no-repeat īackground:url(./images/play.png) no-repeat īackground:url(./images/pause.png) no-repeat īackground:url(./images/stop.png) no-repeat īackground:url(./images/prev.png) no-repeat īackground:url(./images/next.png) no-repeat īackground:url(./images/progress_bg.png) no-repeat īackground:url(./images/progress.png) no-repeat For that, open your css folder and inside that you will see your style.css file. Now we are going to add the css code in our “ style.css” file.Open the index.html page and add the following code. Now, its time to design your front page.Inside the “ Image” folder, you can find the images and in the “ cover” folder, you can find out the cover image of the album.


I’ve attached the screen-shot below for reference: Inside the “ Media” folder, you can see the song list.So, your folder structure should look like this.
Html5 audio player with playlist download#

We are going to incorporate HTML5 audio features as well as JavaScript and jQuery. In this article, we are going to build an audio player using HTML5.
