SoundManager2 sekarang dengan HTML5 Audio!

Schott Schiller, seroang frontend engineer dari moustache-d merilis update terbaru dari library javascript buatannya: SoundManager. Versi terbaru dari SoundManager 2 kini datang dengan tambahan dukungan audio HTML5. Dengan demikian, SoundManager menjadi salah satu dari beberapa JavaScript Sound API yang telah layak disebut HTML5 Audio()-capable selain berkutat dengan format-format populer Flash seperti MP3/MP4.

Fitur utama:
– Support HTML5 Audio() — dalam tahap eksperimental dengan umpanbalik yang dibutuhkan berformat MP3/MP4.
– 100% bebas-Flash!
– API tak berubah, tetap sama walaupun menggunakan HTML5 atau Flash

Nah, berikut kutipan bagaimana SoundManager bisa bekerja:


Determines whether HTML5 Audio() support is used to play sound, if available, with Flash as the fallback for playing MP3/MP4 (AAC) formats. Browser support for HTML5 Audio varies, and format support (eg. MP3, MP4/AAC, OGG, WAV) can vary by browser/platform.

The SM2 API is effectively transparent, consistent whether using Flash or HTML5 Audio() for sound playback behind the scenes. The HTML5 Audio API is roughly equivalent to the Flash 8 feature set, minus ID3 tag support and a few other items. (Flash 9 features like waveform data etc. are not available.)

SoundManager 2 + useHTML5Audio: Init Process

At DOM ready (if useHTML5Audio = true), a test for Audio() is done followed by a series of canPlayType() tests to see if MP3, MP4, WAV and OGG formats are supported. If none of the “required” formats (MP3 + MP4, by default) are supported natively, then Flash is also added as a requirement for SM2 to start.

soundManager.audioFormats currently defines the list of formats to check (MP3, MP4 and so on), their possible canPlayType() strings (long story short, it’s complicated) and whether or not they are “required” – that is, whether Flash should be loaded if they don’t work under HTML5. (Again, only MP3 + MP4 are supported by Flash.) If you had a page solely using OGG, you could make MP3/MP4 non-required, but many browsers would not play them inline.

SM2 will indicate its state (HTML 5 support or not, using Flash or not) in console.log()-style debug output messages when debugMode = true.

Tertarik? Silakan cek source code terbaru disini:

Wagiman Wiryosukiro

Petani Sistem Informasi, tukang las plugin & themes Wordpress. Co-Founder Saat ini aktif sebagai Developer & kontributor di OpenMandriva Linux.

You may also like...

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: