1
votes

I need to get a relatively close information on the actual internet speed in my Windows Store (c#) app. I need this because the user can play videos that are hosted online. There are always two versions of the Video available (high quality/low quality). According to the internet speed of the user, the App should stream the corresponding video version.

I've tried to download a dummy file of 5MB and look at the time that was needed for this task (for getting an idea of the internet speed). But I've found that the results are too scattered and changing. I might get better results with a larger file, but that's not in favour of the user experience.

Is there a more simple way of getting the current Internet bandwidth?

P.S.: IIS Smooth streaming is not possible.

PPS.: Maybe this would be the right path to follow but I do not know how to use this class in my case: StreamSocketInformation.BandwidthStatistics

1
What's available now might not be what's available in 10 seconds time. That's the nature of resources (such as bandwidth) which aren't under the direct control of your application.Damien_The_Unbeliever

1 Answers

0
votes

Get downloading speed by below given code.

var connectionProfile = NetworkInformation.GetInternetConnectionProfile();
var dataPlanStatus = connectionProfile.GetDataPlanStatus();
ulong? outboundBandwidth = dataPlanStatus.OutboundBitsPerSecond;
if (outboundBandwidth.HasValue)
{
    System.Diagnostics.Debug.WriteLine("OutboundBitsPerSecond : " + outboundBandwidth + "\n");
}
else
{
    System.Diagnostics.Debug.WriteLine("OutboundBitsPerSecond : Not Defined\n");
}

Connecting to networks and web services (Windows Store apps using C#/VB/C++ and XAML)

Connection state and cost management (Windows Store apps using C#/VB/C++ and XAML)