# Get the duration of a streaming sound

**URL:** <https://forum.kirupa.com/t/get-the-duration-of-a-streaming-sound/305042>\
**Category:** flash\
**Created:** [February 18, 2010, 10:54am UTC](https://forum.kirupa.com/t/get-the-duration-of-a-streaming-sound/305042 "2010-02-18T10:54:53Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![aub1979](https://avatars.discourse-cdn.com/v4/letter/a/bbce88/32.png) [@aub1979](https://forum.kirupa.com/u/aub1979)\
**Post date:** [February 18, 2010, 10:54am UTC](https://forum.kirupa.com/t/get-the-duration-of-a-streaming-sound/305042/1 "2010-02-18T10:54:53Z")

</div>

Hi,

I am trying to write an mp3 player. I have tried everything and am suck getting the duration of an mp3.

Heres my working code:

```auto

on(press){
	
	function callback1() {
trace("mySound completed");
i++;
output_txt=my_lv2["out"+i];
my_lv["parent"].my_sound.loadSound(my_lv["var"+i],true);
	}
my_sound.onSoundComplete = callback1;

var my_sound:Sound = new Sound();
var my_lv:LoadVars = new LoadVars();
my_lv["parent"] = this;
my_lv.onLoad = function(success:Boolean) {
if (success) {
	
my_lv["parent"].my_sound.loadSound(my_lv["var"+i],true);
my_sound.onSoundComplete = callback1;
} else {
trace("Error loading/parsing LoadVars.");
}
};
my_lv.load("playText.txt");
	
var my_lv2:LoadVars = new LoadVars();
my_lv2["parent"] = this;
my_lv2.onLoad = function(success:Boolean) {
if (success) {
output_txt=my_lv2["out"+i];
} else {
trace("Error loading/parsing LoadVars.");
}
};
my_lv2.load("outputFile.txt"); 
	
}

```

can anyone help me finish this code to print the total time of a track?

Regards  
Aubrey.
