Saturday, July 22nd, 2006

JSSoundKit: Super-Easy Sound API

Category: Flash, Library

<p>JSSoundKit is wraps the Flash Sound object, making it easy to incorporate sound into your Ajax apps. Really easy, in fact:

javascript
< view plain text >
  1. var mysound = new Sound();
  2. mysound.loadSound("http://www.archive.org/download/Behind/SyncFilmicoBehind.mp3", true);
  3. mysound.setVolume(30);

Sound is a great example of using Flash to achieve progressive enhancement – enhance the experience in those browsers that support the functionality and degrade gracefully for those that don’t … sound is often a nice-to-have rather than a necessity (unless you’re building an MP3 player of course!).

We’ve seen a number of comms libraries that wrap Flash in similar vein, for comms, local storage, etc. As most web developers remain Flash-illiterate, it’s great to see these capabilities unlocked for the masses. If we want, we can build standard web UIs, and pull in Flash for specialized, typically non-presentational, functionality.

Related Content:

Posted by Michael Mahemoff at 4:14 am
16 Comments

++++-
4.1 rating from 23 votes

16 Comments »

Comments feed TrackBack URI

Looks identical to the Flash API (sigh) Ive an idea why not just use flash, lol!

Comment by rb — July 22, 2006

AFLAX. It’s just as easy.

Comment by Phill Kenoyer — July 22, 2006

I don’t get it. What makes this Ajax or news-worthy. Flash and easy-to-use Flash players controlled by JavaScript are all over the place. Most buffer much better than this ap, are skinnable, and have choice of controls.

Comment by Dan — July 22, 2006

Hi,

thanks for posting the project.

There are several reason not to just use Flash.
1. The main idea is – you don’t need to know anything about actionscript or flash to put streaming sound on your web site. Flash is a proprietary tecnology, the API rignt now just wrappes around the ActionScript Sound Object, but we could do this wrapping around a Java Object. Or maybe, convince the browser’s manufactures to implement this natively.
2. It is easier to make javascript with HTML interact with other elements on your web page than it is to do this with flash, although it is also possible.
3. Google or other search engines cannot read flash objects. If you build a page with HTML/Javascript, they will know it exists.
4. I don’t like flash, i prefer to do it in javascript. But that’s just me, if you think flash is better, go with it.

Thanks,
Gustavo Ribeiro Amigo

Comment by Gustavo Ribeiro Amigo — July 22, 2006

Hi,

another thing.

there’s an interesting thing about the MP3 Player’s demo – it loads a playlist dynamically from CCHits (www.cchits.org) using JSON. I used a trick to get around the cross domain restriction, the JSON generated by CCHits may have a starting script like var cchitsPlaylist = {}. Thanks to Fabricio Zuardi, the creator of CCHits, for implementing this feature just for this demo. The JSON is modeled after the XSPF(www.xpf.org) specification.

Maybe the player will become another project/component. It ís distributed with the JSSoundkit with the same license’s term, so anyone can use it and modify it for any porpuse.

[]‘s
Gustavo Ribeiro Amigo

Comment by Gustavo Ribeiro Amigo — July 22, 2006

When I use the mp3 player demo in Safari on OS X and then hit the back button (while the song is streaming), Safari crashes. :-(

Comment by Scott — July 22, 2006

The player is very experimental. I’ve tested on Firefox, IE and Opera on Win2k. Works pretty well on Firefox and IE. On Opera it works, but it is kind of wierd.

Comment by Gustavo Ribeiro Amigo — July 22, 2006

super!

Comment by Azer Koçulu — July 22, 2006

bravo Gustavo! I support you. I personally dont like flash too.
writing things in javascript is much better than flash. Flash sometimes makes page heavier.
Till now it seems a nice api, but buffering needs to be improved as it runs well on all browsers.
:)

Comment by Google Logs — July 24, 2006

bravo Gustavo! I support you. I personally dont like flash too.
writing things in javascript is much better than flash. Flash sometimes makes page heavier.
Till now it seems a nice api, but buffering needs to be improved as it runs well on all browsers.
;)

Comment by Google Logs — July 24, 2006

I was wondering when someone was going to use Flash 8′s ExternalInterface stuff to do some nice JS-driven Flash-based sound! ;)

I wrote a library several years back called “SoundManager” which is similar, though it uses an XML file to declare sounds by ID and their respective URLs etc. The upside is it works pretty consistently in the current browsers, despite not using ExternalInterface.

I have been working on a new version which will provide far more event handler hooks and properties (also like JSSoundKit, using ExternalInterface to talk to Flash.)

I have seen similar problems with Opera in testing, it seems like calls are sometimes “missed” or just don’t fire – I wonder if ExternalInterface may be a bit buggy with the 9.0 release.

Comment by Scott Schiller — July 24, 2006

I have to agree with Dan.. tools like this (and there are others that do basically the same thing which have been out for ages and ages – so credit where it is due) really simplify the development process and are RELEVANT to a discussion about Ajax because:
.
#1 – They are JavaScript based, and 90% of the stuff on these Ajax discussion boards are really more about DHTML and JavaScript than they are about XHR, strictly speaking..
#2 – Ajax is about using JS and DHTML to improve the user experience and offer up new prospects for functionality in web apps.
#3 – That being said, if we limit ourselves to a discussion purely of XHR and omit topics are are ‘too JavaScript, not enough AJAX’, or that use some other transport method (flash api’s) instead of pure XHR – we’re going to get really bored really fast.
.
This is in response to Phill.

Comment by Alexei — July 24, 2006

+1 Alexei.
I have no philosophical issue with Flash, I’ve just not spent a lot of time in that world. Would someone be able post a url or a round-up of similar bridging utilities? (E.g. for charting, sound, video, etc.)

Sam

Comment by Sam Foster — July 24, 2006

Yet another reason to be glad that I browse on a computer with headphones – and the headphones off most of the time.

Comment by Eric the .5b — July 24, 2006

A few years ago people would either look at you crazy or ignore you if you mentioned things like XHR and hidden iframes to do remote communication… then Google legitimized it.

What’s ignored today or looked at crazy in the Ajax/DHTML world? Things like JSON-P; hidden Flash to extend the runtime for things like local storage, cross site web services, etc.; Comet; pragmatic offline access; and more. I’m just waiting for a big co to legitimize it then everyone will feel safe to use it… why wait until then though? Think for yourself and decide if something is useful or not and if it could open new possibilities.

Best,
Brad Neuberg

Comment by Brad Neuberg — July 24, 2006

Brad,

One example would be 37S’s Campfirenow (and probably other chat apps), which makes a sound every time a new message comes along.

Comment by Michael Mahemoff — July 25, 2006

Leave a comment

You must be logged in to post a comment.