Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
radykal

Duration of MP3Loader

Recommended Posts

Hi,

 

I notice that the right duration of the MP3Loader is initial available when the mp3 has been completly loaded. Is that right???

 

When I´m using the PLAY_PROGRESS listener and trace the duration in the handler, I get a wrong duration during the loading process.

Link to comment
Share on other sites

No, the duration should be set if it's available when the ID3 event is dispatched by the Sound object but if your MP3 file isn't encoded properly that may not happen. It will try again once the file completely loads or whenever you manually get the "duration" property).

 

Could you please post your MP3 file that's problematic? Don't forge to zip it first. It'd be even better if you also posted a super-simple FLA that demonstrates the issue (with trace() values for example).

Link to comment
Share on other sites

I send you a mail with zip. I thought it could be a mp3 probelm, but I used this mp3 with another mp3 player, which is not using your MP3Loader class and there I get the right duration after the meta data has been loaded.

 

I also tried it with two other mp3´s and there the onInit event hasn´t been even dispatched, although I set the listener for it in the vars. Weird!!!

Link to comment
Share on other sites

Ah yes, I see the problem. The Sound object's "length" property cannot be accurately determined until the file has completely loaded. That's just a Flash limitation. However, I just posted an update that improves the behavior in several ways:

 

1) It will continuously estimate the duration property more and more accurately while the file loads.

 

2) There's a new initThreshold property that's 102400 (100k) by default and it gives you a way to force MP3Loader to wait until a certain bytesLoaded is reached before the LoaderEvent.INIT event is dispatched. The higher the initThreshold number, the more accurate the duration will be when the INIT event is dispatched. It should already be pretty accurate using the default 102400 value, but feel free to change it if you want.

 

Get the latest version at http://www.LoaderMax.com (or log into your GreenSock account if you're a Club GreenSock member).

Link to comment
Share on other sites

Wonderful....now the playProgress property is running right during the loading process. In the older version I got a value over 1 during loading. I used playProgress in combination with a seek bar and during loading the seek bar overshoot the mark and gets his right position after download completes.

 

Thanks

Link to comment
Share on other sites

  • 1 year later...

I am having a similar issue with Sound duration, even after completely preloading the Sound.

 

Turns out that Actionscript's built-in Sound.length is not reliable. I tried using the MP3Loader and got the same inaccurate result. Perhaps it's an issue with smaller files, since they load too quickly for load speed to be enough information.

 

Please see attached MP3. The sound is under 3 seconds, but is being reported at almost 4. I have been unable to find a resolution to the issue, but it seems like just the sort of thing the LoaderMax library would resolve ;)

Link to comment
Share on other sites

please zip your mp3 before posting. thanks.

 

keep in mind that if any native as3 property is being reported inaccurately it is going to impact the accuracy of MP3Loader

Link to comment
Share on other sites

Sorry about not zipping the MP3 first. Further investigation has revealed that Flash assumes all MP3s were encoded at 44100hz. Once I reencoded the audio assets, everything worked as expected. That's an awful big bug for Adobe to just keep in Flash for who-knows how long.

Link to comment
Share on other sites

wow that is really strange. thanks so much for postings your findings. could be a big help to folks in the future.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×