SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    if ($zee == "Guru") { $zee--;}
    Join Date
    Nov 2005
    Location
    Karachi - Pakistan
    Posts
    1,134
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Determine connection speed

    Hi

    I want to know if this is possible. Actually i have a flv video. I made 2 quality of it 1 is hogh quality and 2 is much lower. that is to match the client's connection speed. so that it will play a smooth video.

    Now i want to know if there is a true mean to determine the user's connections speed ? (I need a javascript or PHP solution for this) is there anyone who may help me ?

    Thanks

  2. #2
    if ($zee == "Guru") { $zee--;}
    Join Date
    Nov 2005
    Location
    Karachi - Pakistan
    Posts
    1,134
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    is this site OK ?
    http://www.howzippy.com/

    please guide ....

    can i have a similar code which will just give me a result like 45KBs/sec
    ???

  3. #3
    if ($zee == "Guru") { $zee--;}
    Join Date
    Nov 2005
    Location
    Karachi - Pakistan
    Posts
    1,134
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    46 views but still no reps ???????????

  4. #4
    SitePoint Enthusiast
    Join Date
    Aug 2007
    Posts
    49
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I replied. I don't know why it didn't show up.

    Record the time at the top of the page. In the onload event for the image or whatever, check the time again and subtract.

  5. #5
    if ($zee == "Guru") { $zee--;}
    Join Date
    Nov 2005
    Location
    Karachi - Pakistan
    Posts
    1,134
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    humm, THANKS for your reply. But can u show me some sample code ? I m not a good programmer. Further, what will be the perfection of that scheme you just told me ?

  6. #6
    SitePoint Wizard
    Join Date
    Nov 2004
    Location
    Nelson BC
    Posts
    2,310
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Here's an example:
    Code:
    <html>
    <head>
    <script type="text/javascript">
    var imageURL = "http://www.utexas.edu/friends/graphics/wallpapers/BigBertha1024x768.jpg"; // url of test image to use
    var imageSize = 152248; // size of test image in bytes
    
    var startTime;
    var endTime;
    function startLoadImg() {
    	var speedTestImg = new Image();
    	speedTestImg.onload = endLoadImg;
    	startTime = new Date();
    	speedTestImg.src = "http://www.utexas.edu/friends/graphics/wallpapers/BigBertha1024x768.jpg?randomthing=" + startTime;
    }
    function endLoadImg() {
    	endTime = new Date();
    	document.getElementById("seconds").innerHTML = Number((endTime - startTime)/1000).toFixed(2) + " s";
    	document.getElementById("speed").innerHTML = Number(imageSize / (endTime - startTime) * 1000 / 1024).toFixed(2) + " KB/s"; // kilobytes per second
    }
    </script>
    </head>
    <body>
    	<button onclick="startLoadImg();">perform test</button>
    	<div>Time taken:<span id="seconds"></span></div>
    	<div>Speed:<span id="speed"></span></div>
    </body>
    </html>

  7. #7
    SitePoint Enthusiast
    Join Date
    Aug 2007
    Posts
    49
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That code is running on my web site, if you look, you can probably find it. Sorry, but I don't really have time to explain it in detail unless you want to hire me.

  8. #8
    if ($zee == "Guru") { $zee--;}
    Join Date
    Nov 2005
    Location
    Karachi - Pakistan
    Posts
    1,134
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks a lot. thanks a million. Please let me know how much is this accurate ?


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •