Flash Media Server Developer Documentation

About detecting bandwidth

Matching a data stream to the client's bandwidth capacity is perhaps the most important factor in ensuring a good playback experience. Once you have detected a user's bandwidth, you can:

  • Choose a video encoded at a bit rate appropriate for the user's bandwidth speed.
  • Play a video and set the buffer size based on the detected bandwidth.

In Adobe Flash Media Server 3, bandwidth detection is built in to the server. The new bandwidth detection, called native bandwidth detection, provides better performance and scalability. To use native bandwidth detection, make sure bandwidth detection is enabled, and write client code that calls functions built in to Adobe Flash Media Server.

With native bandwidth detection, you can use any version of ActionScript on the client (examples in ActionScript 2.0 and 3.0 are provided below). You do not need to add or change server-side code.

If you prefer to use your existing server-side bandwidth detection code from a previous release of Flash Media Server, you can disable native bandwidth detection by configuring BandwidthDetection in Application.xml.

Initiate bandwidth detection from the server

The following Sever-Side ActionScript code initiates bandwidth detection from the server. In an edge-origin deployment, bandwidth is detected at the origin server, not at the edge server:

application.onConnect = function (clientObj){
    this.acceptConnection(clientObj);
    clientObj.checkBandwidth();
}

When initiating bandwidth detection from the server, do not call checkBandwidth from the client.