Search code examples
c#javascriptdownload-speed

How can I find out the download speed of the client from server?


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.


Solution

  • 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.