Ryerson Flash Communication Development Server  
  Ryerson Home > Ryerson Flash Communication Development Server > Stream Proxy Test

Stream Proxy Test


Introduction

The server-side Stream object can be used to proxy streams. This is an important feature that enables:

  1. providing one stream clients can subscribe to that plays other recorded or live streams - this can be used to create play lists or dynamically switch between streams in a presentation;
  2. stream chaining between servers - passing a stream from one FlashCom server to another where the stream can be played or recorded;

One advantage of creating a stream with the server-side Stream object that plays another stream is that it can provide a very fine-grained-programtic control of what streams a client can see. A server-side script can decide on a stream-by-stream basis what client (and therefore what user) can subscribe to a given stream. For example a professor can publish and record a stream into a directory that normally has restricted access. During a certain time period, and only for certain users, the professor could grant access to the stream without giving every client that connects read access to the directory the stream is in.

A Simple Test Application

This would normally be done by modifying an access control list (ACL) of some type. User's whose user names were in the access control list (or who were in a group in the ACL) would be able to read the stream because a server-side script would look them up in the ACL and proxy the stream for them. Each user would have their own private read-only folder and the stream would be played in it. The simple test application provided here was designed as a proof of concept for this idea and does not implement an access control list. It was designed to test/demonstrate how the server-side Stream object can be used to make available an otherwise read protected stream. In the test scenario:

  1. Two streams are stored in the streamProxy0/streams/test/private folder - or in the private folder for short. The two flv files are named:
  2. The test client initially has global read access and can play streams directly in the private folder. A provided "Direct Play" button can be used to test that either stream can be played using the paths:
  3. A server-side method named restrict is provided to toggle the client's read access between global read access: and restricted access: which restricts the client to being able to only subscribe to streams originating in the client's own unique temporary directory. The read access of the client can be controlled by using the "Restrict Access" button.
  4. A server-side method named startProxiedStream can be called to create a new stream in the client's temporary directory and return the correct path to the client. Pressing the "Proxy Play" button will call this method and begin playing the proxied stream.

The test client is below followed by links to all the test files. To run the test press the Connect button. When the client connects it will have global read access. Try using the "Direct Play" and "Proxy Play" buttons to play a stream directly or via the server-side Stream object. Stop any stream that is playing and press the "Restrict Access" button so the client no longer has read access to the private directory. Pressing the "Direct Play" button will now fail to play the stream while pressing "Proxy Play" will continue to work.

Source files:

One Problem:

The code in the example above starts the stream playing on the server after which the client subscribes to it and plays it. The result is that that you can often hear the audio immediately while it takes a while for the video to start playing. The client below works a little differently. It:

  1. gets the full path to the stream by calling a server-side function named getProxiedStreamPath;
  2. subscribes to and starts playing the stream;
  3. calls a server-side function named startProxiedStream so the server will start publishing the proxied stream.

 


This document was written by Brian Lesser and last updated: . If you find any problems with it or the application please let me know.