Detecting Connection Speed For Use In Preloader
I had an "A-Ha!" moment, and I don't think I've ever seen it on this board, so I thought I would share.
It is possible to detect (estimate) connection speeds during the preloader. This would be useful when deciding how much of the movie to load before proceeding. For example, if you know that your user is on a cable modem, you know that the download could keep ahead of the playhead if 50% of the movie is loaded in the preloader. However, a 56k modem might require 80% of the movie to be preloaded.
In your preloader, prior to the loop, initialize a variable, and set it to the number of bytes loaded. Create a constant that stores a sample speed in seconds. Create a new function that reads the current bytesloaded, compares it to the old bytesloaded, and calculates the DL-speed based on the sample rate. Last, create an interval that calls the function every samplerate*1000 (since intervals go off of milliseconds).
Note: This must all be done BEFORE your preloader frame loop, so that multiple intervals aren't being created.
Here is how I coded it:code: var kSampleRate = 0.5; // This is the Sample Rate in Seconds.
var kDownloadSpeed; // This will be where the DL Speed gets stored
var iLastBytesLoaded; // a Public variable to store the initial bytes in
function GetDLSpeed(){
clearInterval(tDownloadSpeed); // Create your interval for sampling
// DL speed = (finalBytes - initialBytes) / time
kDownloadSpeed = (this.getBytesLoaded()-iLastBytesLoaded)/kSampleRate;
}
function SampleDLSpeed(){
iLastBytesLoaded = this.getBytesLoaded(); // Set your initial sample
// Create your interval to check ever specified time (Determined by sample rate)
var tDownloadSpeed = setInterval(GetDLSpeed, kSampleRate*1000);
}
SampleDLSpeed();Keep in mind that this is an estimate. Connection speeds vary, and will be affected by what else the user has downloading, but this is a good thing since we want to know the stream speed that this SWF is getting, not if they have DSL.
Also, this is not exact because intervals are not precise. A 1.0s interval may fire at 1.05s (See Flash's ActionScript Dictionary on setInterval for more info.) Using a larger sample rate will be more precise but take more time to sample.
FlashKit > Flash Help > Flash General Help
Posted on: 05-20-2004, 11:12 AM
View Complete Forum Thread with Replies
Sponsored Links:
Detecting Connection Speed
I'd like to find out how to make my preloader detect the users connection speed and also give approximate time of completion for the download...
how do i do that?
also, when using a bar graphic that increas in size depending on the percent loaded, how do you make the bar grow in one direction, for example- the left edge of the graphic stays in place and the bar grows to the right as the file continues to load...
thanks in advance,
-myk
View Replies !
View Related
Detecting Connection Speed
Does anyone have an example or know how to detect a users modem connection speed? I would like to create a preloader in Flash MX that based on the users connection speed I would only load a certain portion of the external flash movie before planning to give the appearance of streaming. So if a user had a slow connection I would load half the file wherease if the user had a fast connection such as a T1 I would only load 20%.
View Replies !
View Related
Detecting Connection Speed
Hi --
I'm building a site with some (progressive) video and would like to insert some code that will determine a user's connection speed so I can play either a high-res or low-res clip. Not finding a whole lot on the net about it... thought I'd try here.
Any help would be greatly appreciated!
View Replies !
View Related
FLV- Detecting Connection Speed
Hi,
Do you guys know if there is a way to detect a user's connection speed for the sake of dynamically setting the onStatus() buffer method to minimize a user's wait before I start playing a video or audio stream?
btw- All I found in Help files and on LiveDocs is reference to using something called a SMIL file like this...
Code:
<smil>
<head>
<meta base="rtmp://myserver/mypgm/" >
<layout>
<root-layout width="240" height="180" >
</layout>
</head>
<body>
<switch>
<video src="myvideo_mdm.flv" system-bitrate="56000" dur="3:00.1">
<video src="myvideo_isdn.flv" system-bitrate="128000" dur="3:00.1">
<ref src="myvideo_cable.flv" dur="3:00.1"/>
</switch>
</body>
</smil>
BUT (2) things-
1. Is this actually detecting connection speed?
2. Is this only usable with Flash Comm Server?
Is there something for the rest of us to do in actionscript ???
:?
View Replies !
View Related
Detecting A Users Connection Speed
Does anyone have an example or know how to detect a users modem connection speed? I would like to create a preloader in Flash MX that based on the users connection speed I would only load a certain portion of the external flash movie before planning to give the appearance of streaming. So if a user had a slow connection I would load half the file wherease if the user had a fast connection such as a T1 I would only load 20%.
View Replies !
View Related
Detecting Connection Speed And Player Version
Anybody have (or know a source for) an actionscript that will do all of the following:
1. Detect the broadband connection speed of a site visitor.
2. Detect the version of Flash Player they have.
3. Use above information to steer the visitor (seamlessly and unbeknownst to them) to the one of several versions (on a streaming server) of an flv'd video that is the most appropriate for their connection speed/player version combo?
Also, what range of kbps versions would cover *most* situations (e.g., 100, 300, & 450?)
Thanks.
View Replies !
View Related
Connection Speed And Time In Preloader ?
how can i add current download speed and time remaining ( and time needed for download ) in my preloader???
I have found something about that on the board when i was looking for something else, and now when i need that i canīt find it.
Anybody knows the script for this??? I just finished my preloder with total and loaded bytes, loader status bar and percent....
but then i saw preloader with time and connectin speed and i want that on my web page
thanks!
[Edited by rimpampa on 08-05-2002 at 08:22 AM]
View Replies !
View Related
Preloader That Detects Speed Of Connection
Hi,
I'm no expert in Actionscript so I'm not sure whether this can be done or not but what I'm looking to do is create a preloader that looks at what the users connection speed is (without sending a file to their computer i.e. like speed tests) and the has several outcomes:
Low Speed = image
Medium Speed = low quality video
High Speed = high quality video
Any help would be appreciated.
View Replies !
View Related
Streaming Audio Speed No Good - Depends On Processor Or Internet Connection Speed?
we are launching a narrated, streaming flash 6.0 presentation for a client. frame rate is 20fps. here is the link:
http://www.optionaldesigngroup.com/preston
they sent us this email:
"I do not know who else this may be happening with, but when Marjorie Sanders (OC) opened to take the tour, it loaded the software (not sure why her machine didn't have it), and the video was the size of a postcard, Kathleen sounded like a little child (almost munchkin like) and was going 100 mph (so very, very fast - almost unintelligible). Can we experiment with it. Could it be because of the download - I would hope that people don't receive it that way or they will end up laughing at it (it is almost silly)."
does the streaming sync depend on the internet connection or the processor speed? i am assuming processor, and that on a kick-butt new machine it will stream faster then on a slower one.
i think the only way to counter for this is to go in and add some more frames in the narration between phrases. we don't want to lower the framerate because it will affect the flow of the tweens.
any thoughts on this would be greatly appreciated. thanks.
View Replies !
View Related
Detecting Internet Connection
Hi.
I visted a site resently that detected my connection in which some large file was'nt loaded as I have a Modem connection. Great Idea
Do you know of this action script ? Is there an FLA out there to help ?
I think the action script checked the my speed and calculated if I was broadband
of Modem.
Not very good in action scripting. Any help would be greatful.
D
View Replies !
View Related
Detecting Internet Connection
Suppose I have a very long SWF (let's say it takes about 20 minutes for one to go through the whole movie).
At the end of the movie I would like to check if the user is still connected to the Internet (they maybe on an unstable dial-up connection and lost connection).
Is there anyway to do that? I mean, is there a way to check if a user is connected to the Internet using ActionScript?
Thank you!
View Replies !
View Related
Detecting Internet Connection: (possible?)
hey yall,
trying to figure out how to detect if someone is online. Im doing a CD rom that either shows the regular content, or connects to a database on the web to retrieve info.
Anyone know the proper actionscript for this? The detect itself must be inside flash, and can't rely on an outside script (incase they are not connected, in which case they wouldnt be able to run it)
Any ideas?
View Replies !
View Related
Connection Speed
Hi All,
I've just been trawling the forums for some info about detecting an end users connection speed, ie: to determine whether it is modem/dsl etc...
I found one thread that contained code which apparantley works perfectly.
This is the code:
if (_root.getBytesLoaded() == _root.getBytesTotal()) {
gotoAndStop(3);
} else {
bytesLoaded = _root.getBytesLoaded();
bytesLeft = _root.getBytesTotal()-_root.getBytesLoaded();
bytesTotal = _root.getBytesTotal();
kbytesLoaded = Math.round((_root.getBytesLoaded()/1024)*100)/100 add " K";
kbytesLeft = Math.round((_root.getBytesTotal()-_root.getBytesLoaded()/1024)*100)/100 add "K";
kbytesTotal = Math.round((_root.getBytesTotal()/1024)*100)/100 add " K";
percent = Math.round((_root.getBytesLoaded()/_root.getBytesTotal())*100) add "%";
loadBar = int((_root.getBytesLoaded()/_root.getBytesTotal())*100);
time = (getTimer()/1000);
bps = bytesLoaded/time;
bits = bps/1024;
Kbps = Math.round(bits*10)/10 add " Kbps";
}
Can anyone explain to me how this should be used ie: what to attach the code to (frame or mc) and how I can define the relevant version of my site to use (modem or faster connection version).
Any help or pointers or other suggestions will be much appreciated.
Diggz
View Replies !
View Related
Connection Speed
Hi everyone,
I am wondering... Is there a way to know the connection speed of the user...
Example: if the user is on 56K or lower, load a light external swf, if the user is on cable or higher, load another heavier swf.
Anybody can help?
View Replies !
View Related
How To Calculate The Connection Speed ?
hi all
I made a variable in the first frame and I assigned the
gettimer() then in the second frame I made
another one has the same value
that what my friend said and finally
my script been shwo = getBytesLoaded/(time1 - time0);
is this correct ? please can someone post here the
script
View Replies !
View Related
Connection Speed Detector
I went to a website a while back and it detected I had a high speed connection and sent me to the flash version of the site. Their page is gone so I can't contact them. Does anyone know of a detector for download or the exact code they used?
I figure they had me download something and tested the download time or transfer rate.
View Replies !
View Related
Connection Speed Detection
I am new to flash. I have created a movie and placed it onto my website, I don't know much about action scripting. Does anyone know of a way I can detect connection speed then redirect based on that speed? I want dial up users to enter my site without the movie, I want broadband users to view the movie...
Any tips or advise would be greatly appreciated.
View Replies !
View Related
Detect Connection Speed
I have seen a few posts on this in the past. I would like to make a page which detects the clients connection speed before connecting them to a flash or static web page. So ideally it would not have flash in the detection page
Which are the best ones?
Thank you
[Edited by jim2002 on 09-24-2002 at 05:52 PM]
View Replies !
View Related
Loadmovie And Connection Speed?
hi
i have a problem with loading movies. i have my main swf file that loads another swf called boreaalne.swf in a movieclip called container. i use loadMovie("boreaalne.swf","contents");
now if you use the menu located in the main swf i want the loaded swf (boreaalne.swf) to first play its end sequence and the load the new movie into the container.
the code for buttons is:
on (release) {
_level0.contents.gotoAndPlay("theEnd");
_global.Section = "universe.swf";
}
so, the playhead in boreaalne.swf goes to framelable theEnd and plays it. the keyframe at the end of theEnd contains this script:
loadMovie(Section,_level0.contents);
stop();
so, the file called univers.swf should be loaded.
and now to the problem. whan i test it on my hard driver, everything is fine. when i click on a button in the menu theEnd is played and universe.swf is loaded. but when i upload it to the server every click on the button doesn't do what i want. this means that i have to wait some time before i click on the button or nothing will happen.
i'm assuming this problem has something to do with the way swf files are fed to your computer over the cable because everything is okay on my own computer.
so, please check out
http://www.tfd.ee/temporalis/temporalis.html and explain...
thank you in advance
peeter
p.s. the site's in estonian
View Replies !
View Related
Estimating Connection Speed
Is there any way that allows you to estimate the connection speed of a computer, (56k modem, cable), so that you send the person to different versions of the site optimised for their connection speed.
Thanks,
Lenny.
View Replies !
View Related
A Way To Check Connection Speed?
Is there a way to check connection speed, and turn out a booleon depending on pretty much 'high speed' is true and 'dial up' is false?
i have a preloader that would be great for slower connections, but on a fast one it appears as an annoying blip before the animation begins.
any suggestions?
View Replies !
View Related
What Is The Speed Of A Faster 56k Connection?
What is the speed of a faster 56k connection? Because I'm working my latest web site through the bandwidth profiler and I have the normal 56k setting at 4800 bps and then I have a setting labeled fast 56k at 5600 bps. Is that right? Because I remember back when I had 56k and I would download stuff and some times it would go as fast as 7.5 kbs. So I guess I'm just trying to pin down an accurate number for a faster 56k modem
Thx in advance to any one that can help me clear up this little gray area.
JT
View Replies !
View Related
Detect Connection Speed
Hi All,
I've just been trawling the forums for some info about detecting an end users connection speed, ie: to determine whether it is modem/dsl etc...
I found one thread that contained code which apparantley works perfectly.
This is the code:
if (_root.getBytesLoaded() == _root.getBytesTotal()) {
gotoAndStop(3);
} else {
bytesLoaded = _root.getBytesLoaded();
bytesLeft = _root.getBytesTotal()-_root.getBytesLoaded();
bytesTotal = _root.getBytesTotal();
kbytesLoaded = Math.round((_root.getBytesLoaded()/1024)*100)/100 add " K";
kbytesLeft = Math.round((_root.getBytesTotal()-_root.getBytesLoaded()/1024)*100)/100 add "K";
kbytesTotal = Math.round((_root.getBytesTotal()/1024)*100)/100 add " K";
percent = Math.round((_root.getBytesLoaded()/_root.getBytesTotal())*100) add "%";
loadBar = int((_root.getBytesLoaded()/_root.getBytesTotal())*100);
time = (getTimer()/1000);
bps = bytesLoaded/time;
bits = bps/1024;
Kbps = Math.round(bits*10)/10 add " Kbps";
}
Can anyone explain to me how this should be used ie: what to attach the code to (frame or mc) and how I can define the relevant version of my site to use (modem or faster connection version).
Any help or pointers or other suggestions will be much appreciated.
Diggz
View Replies !
View Related
Detect Connection Speed
i'm not sure how difficult this is, but what i want to do is detect wether to person viewing the site is using a broadband or dialup connection. if they have broadband, i want it to load background music; if they have dialup, i don't want it to load. i'm not familiar with any function to detect the connection speed. any help with this is very much apreciated, thanks.
View Replies !
View Related
Estimating Connection Speed
Is there any way that allows you to estimate the connection speed of a computer, (56k modem, cable), so that you send the person to different versions of the site optimised for their connection speed.
Thanks,
Lenny.
View Replies !
View Related
Connection Speed Upload
Hi
I look around the web and i found many sites witch allows get your own speed connection, well my answers is, how can i do for get the upload connection using Actionscript 2.0?.
I was thinking send a variable by POST to a PHP file, and this return to the SWF the size of the variable, so next in flash i cant calculate the speed, but i can't get the bytes sended before finish the send.
How can i get the bytes sended everytime i want until the send finish?
I listining any suggest
Thanks
Bye
View Replies !
View Related
Different Connection Speed Test? What Is Used Most
I know that in previous versions of flash there is a feature allowing you to preview your swf file under different types connections (dial up, DSL, cable, etc)
I'm using flash MX 2004 and can't seem to find the feature. Anyone know where it might be hiding or any good alternative ways to simulate other connection speeds?
Also, I know it depends on the audience, but what are most internet users on these days for a connection speed?
View Replies !
View Related
Detecting Cursor Off Stage > Local Connection
Hello Everyone!
I have two swfs in an html page that talk via local connection.
I'm trying to have an object follow the mouse from one movie to the other. It works well for the most part but it's kinda glitchy since if I move quickly from one movie to the other it won't detect that I left the stage of the first movie.
A hack might be possible due to this flash phenomena:
if you move the object to the edge of the flash movie it'll stop right where the edge of the movie is. On the other hand, if we do the same thing but holding the mouse button down, the object follows the mouse even if the cursor is not on the flash movie anymore and beyond its limits.
Recap: I'm trying to find a way to trigger a function when the mouse leaves the stage or when the mouse is over a flash movie but without clicking on it to gain focus.
Any suggestions?
Thanks yo!
View Replies !
View Related
Detect User Connection Speed
Hello Gurus,
I am searching the forums for a method to detect a user's connections speed (broadband vs dialup) and redirect the mc load to one clip or another depending on speed. I found one method from 2003 - it is a build, not a function. Is there anything (function) new you may know of that addresses this?
Thank you,
Odisey
View Replies !
View Related
Speed Upload Connection Detection
Hi
I look around the web and i found many sites witch allows get your own speed connection, well my answers is, how can i do for get the upload connection using Actionscript 2.0?.
I was thinking send a variable by POST to a PHP file, and this return to the SWF the size of the variable, so next in flash i cant calculate the speed, but i can't get the bytes sended before finish the send.
How can i get the bytes sended everytime i want until the send finish?
I listining any suggest
Thanks
Bye
View Replies !
View Related
How To Test Connection Speed In A Banner Ad?
Hi guys,
Im having some problems with a connection speed detector in a banner im supposed to make for friend of mine. Can anybody help me or give me some pointers on how to make this happen? Im pretty new to actionscript so im kinda stuck here...
Any help will be highly appreciated!
Best regards
Alex
View Replies !
View Related
Flash App That Tests Connection Speed?
Greetings all...
I have seen a couple examples of companies that are using a Flash app to test the connection speed of cable modems, T1 lines, etc...
Do any of you have an idea of how this could be done? Any sites I can visit to see a tutorial of this created?
One example that I have seen is http://www.houston.rr.com/SpeedTest/speedTest.html
How is this built?
any insight would be greatly appreciated.
cheers,
~cs
View Replies !
View Related
ActionScript 3: WebService Calls - Detecting Lost Connection
Hi guys,
I am currently developing an application that calls a server side webservice
to do the authentication. The code for it is fairly easy and works great.
However, if the connection to the server gets lost the "fault" function is
not called. Is there a way to detect this kind of error? I remember that I
had the same problem with Flash Remoting in AS2 and it was quite difficult
to solve that. How can I do that in Flex 2/AS3 with the class
mx.rpc.soap.WebService?
Thanks in advance for your help!
Roger
Code (Flex 2 / ActionScript 3):
var ws:WebService = new WebService();
ws.useProxy = false;
ws.wsdl = "
View Replies !
View Related
|