Copy link to clipboard
Copied
Hey. Is there a way to measure UPLOAD bandwidth? I am writing an application which is sending flv video from webcam. But before I start send the video I need to know what upload bandwidth is on client site (only at the beginning). I have spent a lot of hours to find the solution but google has nothing to offer. Of course I am writing in AS3 and I am using FMS to stream. Please help
Copy link to clipboard
Copied
what kind of app? web-based, air or projector/
Copy link to clipboard
Copied
Web-based, flash. I found a function called "checkBandwidth" nc.call("checkBandwidth", null); performed on the server, but it returns the bandwidth for download, rather than upload. Am I correct?
Copy link to clipboard
Copied
use the filereference class to upload and its progress event and getTiemr to calculate the upload speed.
Copy link to clipboard
Copied
Thanks for the tip. I'll let you know in case of problems.
Copy link to clipboard
Copied
FileReference requires that you manually select a file from your computer. Sorry, but this solution is not acceptable for me do you have any other ideas? Maybe it is possible to embed some file directly to swf and automatically send it to the server and then measure the bandwidth?
Copy link to clipboard
Copied
what class are you using to upload your file now?
and you can try the urlloader class but i'm not sure you'll get more than a crude estimate because i think you'll be limited to determining the time the load operation is executed (but not necessarily when loading starts) and when it completes. i don't think progress events are dispatched for uploads, but you should test that.
Copy link to clipboard
Copied
I use the NetConnection class to connect to the server and NetStream to handle stream from a webcam. Everything goes by RTMP protocol.
I tried to use the URLLoader class but function called load () of this class in the case of upload must be initiated by the user action.
It may come in handy:
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/URLLoader.html#
Copy link to clipboard
Copied
then your netstream has an info property that returns a netstreaminfo instance that has all the properties (eg, currentBytesPerSecond) you need to determine upload speed.
use a loop (like enterframe or timer) to periodically poll the netstream's quality of state and determine the upload speed.
Copy link to clipboard
Copied
kglad‌ you were right to give a hint to the algorithm that uses the timer. This is it:
import flash.events.EventDispatcher;
import flash.events.Event;
import flash.events.NetStatusEvent;
import flash.net.NetConnection;
import flash.net.NetStream;
import flash.utils.Timer;
import flash.events.TimerEvent;
//class definition
.
.
.
// constructor code
public function connect(nc:NetConnection):void{
if(nc.connected){
netStream = new NetStream(nc);
netStreamClient = new Object();
netStream.client = netStreamClient;
netStreamClient.onMetaData = onMetaData;
netStreamClient.onPlayStatus = onPlayStatus;
netStream.addEventListener( NetStatusEvent.NET_STATUS, statusHandler );
var myTimer:Timer = new Timer(500,20);
myTimer.addEventListener(TimerEvent.TIMER, function() {
trace("currentBytesPerSecond (B/s): "+netStream.info.currentBytesPerSecond);
});
myTimer.start();
}
}
//end class definition
Thank you so much for good advice, because the results of your algorithms exactly agree with my previous tests
The problem is that I have to get the highest possible upload bandwidth before sending the film to the server. The reason is that if the user has slow internet connection and most get 1.5 Mbps upload bandwidth, then videos will lost frames and the sound will be poor quality. That's why I want to check it in some way. Maybe embed movie to swf and then send to server without user knowledge? Then I would be Measure upload bandwidth at the beginning. But how to embed flv movie to swf? And What kind of film I would have to send to fill whole upload bandwidth?. Minimum upload bandwidth is 3.0 - 3.2 Mbps with implemented camera settings.
Hint may be the site http://www.speedtest.net there using flash technology is measured first download and then upload bandwidth. My goal is to upload
Copy link to clipboard
Copied
i'm not sure what you're asking.
you can't do anything about the users upload speed. it is, what it is.
you might be able to use some form of data compression so there are less data to send if the upload speed is below some threshold but i'm not sure that's what you want.
Copy link to clipboard
Copied
Hi kglad,
my goal is to see what the maximum upload bandwidth can obtain the client. And nothing more. If we go to the page http://www.speedtest.net and run their speed test then we know how fast is the download and the upload speed of our internet. I need to measure user UPLOAD. As for speedtest.net. Something still is unclear?
And I am looking for solutions on how to measure the speed of sending customer (upload bandwidth). Any tips would be appreciated. Although some already checked.
How speedtest measure bandwidth?
Copy link to clipboard
Copied
Everything I was looking for is speedtest-cli. Thanks for your help and to next time.
Copy link to clipboard
Copied
use:
var maxBPS:int = 0;
if(nc.connected){
netStream = new NetStream(nc);
netStreamClient = new Object();
netStream.client = netStreamClient;
netStreamClient.onMetaData = onMetaData;
netStreamClient.onPlayStatus = onPlayStatus;
netStream.addEventListener( NetStatusEvent.NET_STATUS, statusHandler );
var myTimer:Timer = new Timer(500,20);
myTimer.addEventListener(TimerEvent.TIMER, function() {
trace("currentBytesPerSecond (B/s): "+netStream.info.currentBytesPerSecond);
maxBPS=Math.max(maxBPS,netStream.info.currentBytesPerSecond);
if(myTimer.currentCount==myTimer.repeatCount){
trace('maxBPS=',maxBPS);
}
});
myTimer.start();
}
}
Copy link to clipboard
Copied
Unfortunately, using maxBPS I can check what was the maximum upload bandwidth at real time, and not what the user has maximum upload at all. So in my case completely useless. Speedtest-cli arranged the whole thing and I already implemented it 😉 Everything works fine.
Copy link to clipboard
Copied
Welcome. Unfortunately speedtest-cli turned out to be a mistake 😕 Speedtest-cli working properly. The problem is that it measures the maximum upload bandwidth of the server, not the client (it's python) 😕
I found on speedtest.net information on how they measure the upload bandwidth, but the algorithm has been quite complicated. Here is the link (I need only upload):
I have a problem with sending certain data from the client to the server. The link that I gave is written: "A small amount of random data is generated in the client". How do I send data to the server of a specified weight (e.g. 1 kb of data)? If I find out how to do that then the rest should not be a problem because then I will be able to measure the transfer time of a certain weight of data.
I also found speedtest mini, which can be downloaded here: http://www.speedtest.net/mini.php After unpacking we receive files PHP, JSP, ASP, etc. and some JPG files of various sizes. It is possible that speedtest generates data from these files of a certain size? But how they do that? Generate byte array from JPG? Please help kglad
Find more inspiration, events, and resources on the new Adobe Community
Explore Now