评估连接速度的最佳方式 [英] Best way to evaluate connection speed
问题描述
我的深化发展的应用程序至极必要通过流媒体播放现场获得的音乐文件。
I'm developping an app wich need to get a music file by streaming for playing live.
在请求歌API我可以指定带宽(例如:50kbps,100kbps的,300,600和1 Mbps的)。
In the request song api I can specify the bandwith (eg: 50kbps, 100kbps, 300, 600 or 1 Mbps).
越是带宽大,更多的文件将得到时间来获取。因为我不希望用户被限制有关,我有多种选择来对付它:
The more the bandwith is big, the more the file will get time to be fetched. As I don't want the users to be restricted about that I have multiple choices to deal with it:
-
检测阉手机使用3G,WIFI或边缘,并指定一个带宽为每个连接速度。
Detect wether the phone is using 3g, wifi or Edge and specify an bandwith for each connection speed.
让用户决定歌曲的质量,他将得到:像YouTube(但用户不会是很了解电脑的人:越简单的是软件,它越适合)
Let the user decide the quality of the song he will get: like youtube (but the users won't be people that know much about computing: the more easy is the software, the more it will fit)
有一个方法来正确评价的连接速度。像取一个文件,测量时间,它采取并设置带宽
Having a way to evaluate properly the connection speed: Like fetching a file, measure the time that it took and set the bandwith.
我知道,连接速度可能有很大的差异,如果用户松动了WiFi,或使用3克移动在大街上。而事实是,我不能改变这首歌的时候会玩的带宽。
I know that connection speed could vary a lot if user loose the wifi, or is using 3g moving in the street.. And the thing is that I can't change the bandwith when the song will be playing.
也许你想过这事的经历,你想与大家分享?
Maybe you have experience about that that you would like to share?
感谢您!
推荐答案
的Facebook发布了一个库这样的:
Facebook released a library for this:
<一个href="https://github.com/facebook/network-connection-class">https://github.com/facebook/network-connection-class
这是不存在在2011年。
this wasn't existing in 2011..
这篇关于评估连接速度的最佳方式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!