How can I find out the download speed of the clien

2019-05-08 07:05发布

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.

7条回答
等我变得足够好
2楼-- · 2019-05-08 07:23

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

查看更多
姐就是有狂的资本
3楼-- · 2019-05-08 07:28

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

查看更多
Ridiculous、
4楼-- · 2019-05-08 07:31

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.

查看更多
我想做一个坏孩纸
5楼-- · 2019-05-08 07:37

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.

查看更多
虎瘦雄心在
6楼-- · 2019-05-08 07:45

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?

查看更多
疯言疯语
7楼-- · 2019-05-08 07:45

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

查看更多
登录 后发表回答