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.
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.
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.
The HTML <audio> element is used to play an audio file on a web page.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With