Library provides:
- code to handle both MP3 and AAC audio files
- code to work with the 8tracks API (in progress)
Either include the source code in your project or link the SWC.
The library provides code to play both MP3 and AAC files using a common interface.
A factory is used to load audio files:
import com.eight_tracks.media.AudioFileFactory; // ... var factory:AudioFileFactory = new AudioFileFactory();
Which can then be used to create a handle to an audio file:
import com.eight_tracks.media.IAudioFile; // ... var audioFile:IAudioFile = factory.create('path/to/audio/file');
Which in turn can be used to control playback:
audioFile.volume = .5; audioFile.play();
It will also trigger events so you can update your UI:
import com.eight_tracks.events.*; // ... audioFile.addEventListener(PlaybackEvent.PLAYBACK_COMPLETE, playbackCompleteHandler); audioFile.addEventListener(PlaybackEvent.PLAYBACK_STARTED, playbackStartedHandler); audioFile.addEventListener(PlaybackEvent.PLAYBACK_PAUSED, playbackPausedHandler); audioFile.addEventListener(PlaybackEvent.PLAYBACK_UPDATED, playbackUpdatedHandler); audioFile.addEventListener(PropertyChangeEvent.PROPERTY_UPDATED, propertyChangedHandler);
Coming soon.