In Molokoloco | 19:02 - 26 Feb 2011
Suite à mon billet sur les visualisations musicales… j’ai découvert le “Sound manager V2” une librairie JavaScript/Flash qui permet une gestion avancée des MP3 et autres flux audio…
Cette API est utilisée par les grands noms tels que SoundCloud ou Last.fm … et ceux habitués à jQuery ne devraient pas être désorientés !
External demo: A Noisy DOM – part of a Yahoo! User Interface blog post, Enhancing YUI-based Apps with Audio.
:)
<!-- include SM2 library --> <script type="text/javascript" src="/path/to/soundmanager2.js"></script> <!-- configure it for your use --> <script type="text/javascript"> soundManager.url = '/path/to/sm2-flash-movies/'; // directory where SM2 .SWFs live soundManager.useHTML5Audio = true; soundManager.useFlashBlock = false; // soundManager.debugMode = false; // onready() + createSound() / ontimeout() methods for success/failure: soundManager.onready(function() { // SM2 has loaded - now you can create and play sounds! var mySound = soundManager.createSound({ id: 'aSound', url: '/path/to/an.mp3' // onload: [ event handler function object ], // other options here.. }); mySound.play(); }); soundManager.ontimeout(function() { // (Optional) Hrmm, SM2 could not start. Show an error, etc.? }); </script>
La suite, les démos, la doc, le code… c’est ici : http://www.schillmania.com/projects/soundmanager2/
MyBookReadR | The RSS Wall | Carousel slider | Fast web start | Try it :)
My latest sources and sheets :
Github sources | Personnal wiki | jsFiddle example | WebDev bookmark