Accessibility
Will Law

Will Law

Chief Technical Officer
HostCast
www.hostcast.com

Table of Contents

Created:
25 February, 2005
User Level:
Intermediate, Advanced
Products:
Flashcom

Streaming Through Firewalls and Proxies: From the Client's Perspective

A common set of requirements arise repeatedly when deploying Macromedia Flash Video on web pages. How often have you required Macromedia Flash Player to:

  1. Negotiate its way through the various firewalls and proxy servers that stand between it and Macromedia Flash Communication Server?
  2. Detect the bandwidth of the client so that the appropriate video may be delivered?
  3. Display the first frame of the video as quickly as possible?

These requirements are quite difficult to satisfy simultaneously. Detecting bandwidth can take several seconds to measure. Allowing the default rtmp connection to fail-over and attempt to tunnel on rtmpt:80 can take up to a minute. So how can you bypass the firewall and proxy obstacles and prevent the empty box from appearing in your video window while Flash Player is waiting for content? In short, how do you maintain the usability of Flash Player? The Media class components will not help you—in fact they exacerbate this situation. You can only pass them a single protocol/port combination and they don't detect bandwidth natively.

A good solution would enable you to specify exactly which set of port and protocol combinations you wanted to use in your connection attempts. Such a solution would also measure bandwidth and detect stream length, and it would do all this while delivering the first frame of the video in as short a time as possible.

This tutorial demonstrates how you can create such a solution, using only some relatively simple client- and server-side ActionScript and no media or communication components. I've included a working example, which you are welcome to pick apart, copy, and extend to suit your own needs.

Requirements

To complete this tutorial you will need to install the following software and files:

Macromedia Flash Communication Server

Macromedia Flash MX 2004

Prerequisite knowledge:

A working knowledge of ActionScript, including an understanding of client- and server-side NetConnection and client-side NetStream functions.

Tutorials and sample files:

Recommended articles and resources:

About the author

Will Law is CTO of HostCast, a consulting and development firm in San Francisco. He focuses on Flash video and any bright, shiny thing you hang over his crib.