I'm having a lot of trouble getting the total sample length of an mp3.
Also, when I load in the mp3 it does not play all the way through. It plays about half of it's length.
The mp3 I'm testing can be found here, http://bit.ly/GYSOYj.
The code I'm using to play the sound is:
[Embed(source='assets/ffmangun_loop_79393.mp3')]
private var _snd_class:Class;
private var sound:Sound = new _snd_class as Sound;
protected function application1_creationCompleteHandler(event:FlexEvent):void {
sound.length; // 600;
sound.bytesTotal;// 44652
soundChannel = sound.play();
soundChannel.addEventListener(Event.SOUND_COMPLETE, soundComplete);
}
Update:
It was suggested that I load the MP3 instead of embed it. The result is the MP3 plays the full length and the length and the bytes total are now different numbers.
// embedded values
bytes total = 44652
sound length = 600.8163265306122
// load dynamic values
bytes total = 44678
sound length = 1776.3265306122448
Update
This needs to be determined at runtime.