Jump to content
Search Community

Bandwith detection for preloading

AdrianaBaron test
Moderator Tag

Recommended Posts

I dont know if this question applies here but I'll give it a try... I would like to know if with this tool is there anyway to detect the bandwith of the end user as I would like to preload more when the connection is slow and preload less when its fast... Does anyone knows how to do this and point me into an example? I would greatly appreciate it!! :roll:

Link to comment
Share on other sites

No problem - it's in the ASDocs (inherited by all loaders from LoaderCore).

 

loadTime : Number - The number of seconds that elapsed between when the loader began and when it either completed, failed, or was canceled.

 

Therefore, this would give you the bytes per second:

queue.bytesLoaded / queue.loadTime;

Link to comment
Share on other sites

Sure thanks now I did a trace on my progress of those values but look at this:

log time 16:14:07.580 :: :: target: LoaderMax 'a'progress: 0.00027440355304697263

log time 16:14:07.582 :: :: **********************THIS IS THE load time :0

log time 16:14:07.584 :: :: **********************THIS IS THE bytesLoaded :1117

log time 16:14:07.585 :: :: **********************THIS IS THE bytesLoaded/load time :Infinity

log time 16:14:07.612 :: :: target: LoaderMax 'a'progress: 0.0006183292238310028

log time 16:14:07.613 :: :: **********************THIS IS THE load time :0

log time 16:14:07.613 :: :: **********************THIS IS THE bytesLoaded :2517

log time 16:14:07.616 :: :: **********************THIS IS THE bytesLoaded/load time :Infinity

log time 16:14:07.667 :: :: target: LoaderMax 'a'progress: 0.0009622548946150329

log time 16:14:07.668 :: :: **********************THIS IS THE load time :0

log time 16:14:07.668 :: :: **********************THIS IS THE bytesLoaded :3917

log time 16:14:07.669 :: :: **********************THIS IS THE bytesLoaded/load time :Infinity

log time 16:14:08.26 :: :: target: LoaderMax 'a'progress: 0.0013061805653990632

log time 16:14:08.27 :: :: **********************THIS IS THE load time :0

log time 16:14:08.28 :: :: **********************THIS IS THE bytesLoaded :5317

log time 16:14:08.28 :: :: **********************THIS IS THE bytesLoaded/load time :Infinity

log time 16:14:08.77 :: :: target: LoaderMax 'a'progress: 0.0016501062361830932

log time 16:14:08.78 :: :: **********************THIS IS THE load time :0

log time 16:14:08.79 :: :: **********************THIS IS THE bytesLoaded :6717

log time 16:14:08.80 :: :: **********************THIS IS THE bytesLoaded/load time :Infinity

log time 16:14:08.110 :: :: target: LoaderMax 'a'progress: 0.001994031906967123

log time 16:14:08.111 :: :: **********************THIS IS THE load time :0

log time 16:14:08.111 :: :: **********************THIS IS THE bytesLoaded :8117

log time 16:14:08.112 :: :: **********************THIS IS THE bytesLoaded/load time :Infinity

log time 16:14:08.194 :: :: target: LoaderMax 'a'progress: 0.0023379575777511537

log time 16:14:08.195 :: :: **********************THIS IS THE load time :0

log time 16:14:08.196 :: :: **********************THIS IS THE bytesLoaded :9517

log time 16:14:08.197 :: :: **********************THIS IS THE bytesLoaded/load time :Infinity

 

Why is the load time always 0? when it has passed some time? but as soon as the buffer is full then it starts changing this value? One thing I noticed is that the status is 0 which means that the LoaderStatus.READY therefore thats why it returns a 0... but why is it ready if its loading something? i dont understand :? sorry...

 

Also Im prioritizing this loader with prioritize(true);

Link to comment
Share on other sites

Could you post (or send me) your code? It looks like you might be checking the bytesLoaded on the entire queue but the loadTime of a particular child loader that hasn't started loading yet. The loadTime will start when the loader starts loading (of course), so if the queue hasn't reached it yet, it will be zero until it does. But again, it's very difficult to troubleshoot without seeing your code and being able to test publish an FLA or something to which I can add trace() statements myself. Could you send an example? It doesn't need to be your production files. I just tested loadTime on a LoaderMax queue and it seemed to work perfectly. Oh, and make sure you're using the latest version of course. http://www.LoaderMax.com

Link to comment
Share on other sites

Yeah you were right I was checking against a subloader... sorry :oops:

 

By the way if I do this

 

1. LoaderMaxA.load()

2. LoaderMaxB.append(LoaderMaxA)

3. LoaderMaxB.load()

 

if the LoaderMaxA hasnt finished loading but I append it to the LoaderMaxB and then say to it to load, will that open new threads or something that will actually load LoaderMaxA as well? I mean at the same time 2 loaders will be loading LoaderMaxA?

 

Thanks :)

 

 

Sorry and one more question: is it possible to set the buffer of a VideoLoader after It has been set on the vars properties? like I dont use the vars class cos i dont know how to I place the vars when I create the VideoLoader object...

Link to comment
Share on other sites

...if I do this

 

1. LoaderMaxA.load()

2. LoaderMaxB.append(LoaderMaxA)

3. LoaderMaxB.load()

 

if the LoaderMaxA hasnt finished loading but I append it to the LoaderMaxB and then say to it to load, will that open new threads or something that will actually load LoaderMaxA as well? I mean at the same time 2 loaders will be loading LoaderMaxA?

 

No, don't worry - LoaderMax will intelligently handle that situation. If LoaderMaxA is in the process of loading LoaderMaxB will notice that and let it do its thing. It doesn't force new threads to open or anything like that.

 

is it possible to set the buffer of a VideoLoader after It has been set on the vars properties? like I dont use the vars class cos i dont know how to I place the vars when I create the VideoLoader object...

 

Do you want to set the bufferTime of the NetStream or the bufferMode of the VideoLoader? If you want to set the bufferTime of the NetStream, you'd do myVideoLoader.netStream.bufferTime = myValue. But keep in mind that the NetStream gets recreated whenever the VideoLoader is canceled or unloaded so I'd still recommend setting bufferTime in the loader's vars object too. myVideoLoader.vars.bufferTime = myValue. If you want to set the bufferMode, you'd do myVideoLoader.bufferMode = true;

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.
×
×
  • Create New...