Detecting Broadband?
Moderator: General Moderators
-
ineededasn
- Forum Newbie
- Posts: 1
- Joined: Wed Nov 29, 2006 10:28 am
Detecting Broadband?
I was thinking about putting video on my Website, but I don't want to annoy dial-up viewers with large files loading when they visit my site. I was wondering if there was any way to detect a users connection speed so it wouldn't display the videos if their speed were too low. If anyone knows how this could be done or has any suggestions, I'd love to hear them.
- jayshields
- DevNet Resident
- Posts: 1912
- Joined: Mon Aug 22, 2005 12:11 pm
- Location: Leeds/Manchester, England
- neel_basu
- Forum Contributor
- Posts: 454
- Joined: Wed Dec 06, 2006 9:33 am
- Location: Picnic Garden, Kolkata, India
But You Can detect The Speed By Which You Can Decide What To Do Next
=====================================================
=====================================================
Code: Select all
<?php
/* SURFING SPEED DETECTER SCRIPT */
function tmdf($a, $b)
{
list($a_dec, $a_sec) = explode(" ", $a);
list($b_dec, $b_sec) = explode(" ", $b);
return $b_sec - $a_sec + $b_dec - $a_dec;
}
function tstspd($test_size)
{
flush();
$start_time = microtime();
//You Can Change The $comment As You Wish
$comment = "<!--N-->";
$len = strlen($comment);
for($i = 0; $i < $test_size; $i += $len)
{
echo $comment;
}
flush();
$duration = tmdf($start_time, microtime());
if($duration != 0)
{
return $test_size / $duration / 1024;
}
else
{
return log(0);
}
}
$speed = tstspd(1024);
//More Accrecy Block Started
if($speed > 50)
{
$speed = tstspd(10240);
if($speed > 500)
{
$speed = tstspd(102400);
}
}
//More Accurecy Block Ended
echo sprintf("Helllo User Your Net Surfing Speed is %0.3f kb/s", $speed);
?>Re: Detecting Broadband?
I'm not a fan of websites that decide things for me... Why don't you leave that choice to them? If they find it too slow, they'll leave your site... This way, people that really, really want to see the content actually have a chance to look at it...ineededasn wrote:I was thinking about putting video on my Website, but I don't want to annoy dial-up viewers with large files loading when they visit my site. I was wondering if there was any way to detect a users connection speed so it wouldn't display the videos if their speed were too low. If anyone knows how this could be done or has any suggestions, I'd love to hear them.
If you want you can use a flah based movie player (like the one used by boreme.com) or you can use QuickTime or change the resolution for your movies.
Or you can put a link for broadband user and non- broadband users (many sites uses this). This it' s easier to code just put the two links
in 2 separate fields in table named Movies. The table should be something like this: MovieID, MovieName, BroadbandLink, MediumLink, MovieCategory, etc. And for the page you simply use query for the links.
Or you can put a link for broadband user and non- broadband users (many sites uses this). This it' s easier to code just put the two links
in 2 separate fields in table named Movies. The table should be something like this: MovieID, MovieName, BroadbandLink, MediumLink, MovieCategory, etc. And for the page you simply use query for the links.
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
neel_basu, your code doesn't test the speed of one's connection. Your code doesn't consider caching that many web servers will perform, proxy servers, or actually interact with the client at all. It simply dumps output and times how fast the server will perform it. The result will be way off more often than not.
- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
- neel_basu
- Forum Contributor
- Posts: 454
- Joined: Wed Dec 06, 2006 9:33 am
- Location: Picnic Garden, Kolkata, India
This Php Script Takes A Very Little Time To Test The Speed But If you Use Java Applet Or Flash To test It It Would take Too Much Time Thats Very Annoying For A Visitor
neel_basu wrote:No This Code Is To Test The Connection Speed
He Can Code Like This
If the $speed Is Greater That 256 kbs Then Video Would Be Streemed
else Not
- jayshields
- DevNet Resident
- Posts: 1912
- Joined: Mon Aug 22, 2005 12:11 pm
- Location: Leeds/Manchester, England
-
kingconnections
- Forum Contributor
- Posts: 137
- Joined: Thu Jul 14, 2005 4:28 pm
I think what feyd, is trying to get at is that php is a server side script. All items are executed on the server and displayed in the client. No execution takes place on the client side of this script.
In order for correct download speed to be measured you would have to use a client side processing language ie java, or java script.
In order for correct download speed to be measured you would have to use a client side processing language ie java, or java script.
- neel_basu
- Forum Contributor
- Posts: 454
- Joined: Wed Dec 06, 2006 9:33 am
- Location: Picnic Garden, Kolkata, India
BUT IT WOULD TAKE TIME THATS BORING TO A VISITOR
And If Some One Can Do It In a Very Short Of Time ( Although It May not Not Be So Accurate In A Short time test ) Then Its Good
Else
===============================
With This Script
One Can Guess The Speed how fast data can be pushed to the client
And If Some One Can Do It In a Very Short Of Time ( Although It May not Not Be So Accurate In A Short time test ) Then Its Good
Else
===============================
With This Script
One Can Guess The Speed how fast data can be pushed to the client
I Think Its The Shortest Wayfeyd wrote:how fast data can be pushed to the client