1Bit Audio Player

…a very simple and lightweight Adobe Flash MP3 player with automatic JavaScript insertion. It's main purpose is to act as a quick in-page preview for audio files you link to from your website or blog.

Development

The current version can be found at 1bit.markwheeler.net, while this is the development page.

I've been re-writing the the Javascript to make 1Bit unobtrusive and generally improve it. The first version used jQuery, but has since ben re-written to make it smaller and more portable.

There's still some work to do, but the aim is to continue making 1bit easier to use; to play nice with other scripts and have smarter defaults so it needs less configuration.

Documentation

This is a little sparse at the moment, sorry.

There are 4 options, only the first is required and the other 3 are optional. Though it is recomended setting a value for 'color' as it defaults to #111111

oneBit.apply(selector, color[, background[, size])
selector
a CSS selector string to select the links you want to have a player. This supports most CSS2 and some CSS3 selectors.
color
the color the player icons will be. Specified as a full hex color code, including the #.
background
The background color of the player. this defaults to transparent. Specified as a full hex color code, including the #.
size
The dimensions of of the player in pixels, by default 1bit will estimate the correct size. It's recommended you don't change this unless you encounter problems. There is only one value as height and width are the same.

HTML Output

Once one bit has been applied to a link this is the markup, you can use these elements/classes to manipulate the style of 1bit.

<span class="onebit_mp3">
	<a href="file.mp3">example</a>
	<span class="onebit_player" id="oneBitInsert_1">
		[Flash goes here]
	</span>
</span>

Notes

  1. Improve documentation
  2. Hide the complexity of knowing if the DOM is loaded from the end user
  3. Use Dean Edward's Packer for script compression
  4. Add an option to make OneBit modal, so it can only play one MP3 at once

Demo

Here's an example MP3 that you can play. Test Track - taken from the classic Sonic the Hedgehog (it's also short and quick to load)

More example tracks

From Last.fm free downloads

  1. Dance Dance Dance (3:42) - Lykke Li
  2. Discipline (4:18) - Nine Inch Nails
  3. Space and the Woods (3:57) - Late of the Pier

Usage

Download 1bit.js

You'll need 1bit javascript and 1bit flash files, as well as the swfobject javascript, which 1Bit requires.

Then use like so (full documentation to come).


oneBit = new OneBit('flash/1bit.swf');

oneBit.ready(function() {
  oneBit.apply('.content a', '#263B83');
});