4

According to the client's download speed I want to show the video's either in low or high quality. Any Javascript or C# solution is acceptable.

Thanks.

Ali Ersöz
  • 14,982
  • 10
  • 47
  • 62

7 Answers7

2

There isn't any way to be sure. You can only measure how fast you can send data to the client. Without any kind of input from the client to indicate how fast it is getting the information, there isn't much you can do.

You could redirect the client to a page which uses javascript to download an element in the page which is of known size. Then, take the time at the beginning and at the end of the download and redirect the page to a URL constructed through javascript on the client which sends you the time it took to download the element.

Given that you know the size of the element, you can then estimate a rate and make a guess as to the download speed.

casperOne
  • 70,959
  • 17
  • 175
  • 239
2

Here is a post about how gmail works and how it finds the internet speed of the user. You can get some ideas.

Shoban
  • 22,724
  • 8
  • 60
  • 105
1

Maybe, in javascript, you can do something like:

var testImg = document.createElement('img');
testImg.src="src.jpg"; // image with known size
var imageSize = 10; // for 10 k image
testImg.onload = function(){
   var downloadRateKPerSrc = imageSize/((new Date().getTime() - startTime)/1000);
};

testImg.style.display='none';
var startTime = new Date().getTime();
document.body.appendChild(testImg);

untested code - but this idea might work?

sth
  • 200,334
  • 49
  • 262
  • 354
gene tsai
  • 432
  • 3
  • 3
0

Most web sites simply let the user choose a high quality or low quality version.

Chase Seibert
  • 15,061
  • 5
  • 48
  • 58
0

This is a bad idea, not least because most users can control their bandwidth themselves (i.e. I'm running P2P apps that use significant bandwidth, but I turn them off if something else needs priority.)

mqp
  • 64,209
  • 13
  • 90
  • 122
  • I know that client's bandwidth could change by the applications that he/she uses. I'm want to know the available speed. But it seems there is no way to find out this. – Ali Ersöz Mar 24 '09 at 18:51
0

You could use Silverlight or Flash as upload pugin. This will enable you to have a real control on the client on what is uploaded, what the state is and what the upload speed is when the upload has been started.

Geo
  • 1,127
  • 10
  • 17
0

You could look up their address in GeoIP Netspeed: http://www.maxmind.com/app/geolocation

Gerald Combs
  • 1,304
  • 10
  • 11