Creating a Simple Audio Player with SoundManager 2



Originally published at:
Two very useful features introduced in HTML5 are the audio and video elements, which allow audio and video to be played natively in the browser. Before this innovation, people wanting to offer video or audio on their websites had to rely on third party software like Flash.

Fortunately for us, audio and video have solved this problem, at least partially. I say partially for two main reasons. The first is that not all the browsers that developers are asked to support have implemented these elements, like some old mobile browsers and old versions of Internet Explorer. The second reason is that browsers haven’t reached agreement on the formats to implement, so today we have different browsers supporting different formats. This happened due to “political” reasons rather than technical ones, but whatever the cause, we have to face these two issues.

With this in mind, if you want to use either of these elements in a website, not only do you have to provide different formats for each audio or video you want to play, but you also need to offer a fallback for browsers not supporting audio and video. To achieve this goal, you can either use the native methods and then install a library that offers you a Flash-based player with its own features and APIs, or you can use an all-in-one library that exposes the same APIs and provides a native solution or a Flash-based solution depending on the capabilities of the browser.

In this article, we’ll look into the second option, by discussing one such all-in-one library called SoundManager 2.
Continue reading this article on SitePoint


This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.