Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Build HTML5 audio player with web audio API

The <audio> tag streams the input and plays it. This is not suitable when we have to sync multiple audios. Explained here in SO answer https://stackoverflow.com/a/16498601/287100

So I would like to build an audio player which doesn't stream audio rather it downloads it or uses web audio API. I know how to load audio using API but don't know how to hook up it with progress bar with seeking feature.

like image 730
pramodtech Avatar asked Mar 27 '14 07:03

pramodtech


People also ask

How do I embed audio in HTML5?

How to embed audio in HTML? To embed audio in HTML, we use the <audio> tag. Before HTML5, audio cannot be added to web pages in the Internet Explorer era. To play audio, we used web plugins like Flash.

Can HTML5 play audio?

HTML5 features include native audio and video support without the need for Flash. The HTML5 <audio> and <video> tags make it simple to add media to a website. You need to set src attribute to identify the media source and include a controls attribute so the user can play and pause the media.

How can I play audio from a website in HTML?

The HTML <audio> element is used to play an audio file on a web page.


1 Answers

Here's a (very bare-bones and not particularly nice) little player I just made on JS Bin: http://jsbin.com/lenapigo/1/edit

There have been a lot of questions on StackOverflow about making simple players, so hopefully this will be a good enough example that it can be helpful to people.

I didn't take the time to really comment this, but I think the code is reasonably clean and variables have fairly descriptive names, so hopefully that'll be enough to provide some value.

Let me know if you have any questions. But I probably won't be able to dedicate much time to actually writing any additional code for this if you want more features.

Good luck.

like image 155
Kevin Ennis Avatar answered Nov 15 '22 06:11

Kevin Ennis