Publishers of technology books, eBooks, and videos for creative people

Home > Articles

Creating a Stream Archive System in Macromedia MX

Learn how to create a FlashCom application and client that enable two users to conduct an audio/videoconference, which is recorded by the FlashCom application.
This chapter is from the book

In this final chapter of Part III, you will learn how to create a FlashCom application and client that enable two users to conduct an audio/videoconference, which is recorded by the FlashCom application. A user can then open another client movie to watch any previously recorded session. Perhaps more than any other example in previous chapters, this application requires careful attention to the order of operations—when streams and SharedObject instances are invoked and how properties are stored and retrieved. Among other techniques presented in this chapter, the uses of proxied SharedObject data and common stream file locations are discussed.

In order to build the application, you need to have access to a FlashCom server. Preferably, you should have a Developer installation of the FlashCom server on the same machine you are using to create the Flash documents.

An Overview of the Application

The conference application you are about to build must solve several problems that have not been explored in previous chapters and exercises. Before you go any further with the material in this section, try out the conference application at the following URL:

Before you enter the application, you may want to find another online friend who has a Webcam and a microphone and wants to participate in a chat with you. On the Web page at the book's Web site, click the conference recorder link. A Flash client movie (Figure 13.1) loads into the Web browser.

Figure 13.1Figure 13.1 The conference recording client.

Two Input text fields are presented on the first screen, one from the conference's title and another for its room name (that is, the application instance's name). The title is preassigned with the current date. Type a room name into the appropriate field, and click the Proceed button.


You can only use alphanumeric characters and the underscore ( _ ) character in the room name. All other characters are prohibited in the field. If you are conducting a conference with another person, make sure that person uses the same room name that you entered.

When the next screen loads (Figure 13.2), you see some familiar UI elements discussed in previous chapters and examples, such as the SimpleConnect, ConnectionLight, SetBandwidth, and AVPresence components. Type a login name in the SimpleConnect component and click the Login button. Choose your preferred bitrate in the SetBandwidth instance. If you want to change the title of the conference session, change the title in the field at the bottom of the movie and click the Change button. In either of the AVPresence components, click the Send Audio/Video text link. Your audio and video will begin to stream to the FlashCom application instance, and any other user connected to this application instance will see your audio/video stream. If you have another friend participating in the chat, instruct him to begin streaming with the other instance of the AVPresence component. After you have spent a few moments conversing, close the Flash movie and instruct your friend to do so as well.

Figure 02Figure 13.2 The chat frame of the recording client.

Go back to the original URL ( and click the conference retrieval link. This Flash client movie (Figure 13.3) has only one screen, where you can choose a previously recorded conference session in a ComboBox component. If necessary, log in to the FlashCom application by typing your name into the SimpleConnect instance and clicking the Login button. Choose the title of your conference session from the ComboBox instance. The audio/video streams from your conference will begin to play in the respective video windows of the client. You can also view any other videoconference recorded by other users of the application.

Figure 13.3Figure 13.3 The conference retrieval client.


Streams recorded by public users of this example are frequently deleted from the FlashCom server used for the site. The degree of synchronization between the recorded streams largely depends on low latency values during the recording and playback of the streams. If the connection to the FlashCom server is slow, the two streams may play back with less-than- perfect synchronization.

While the operation of this Flash application may seem simple enough, several tasks must be accomplished in both client- and server-side ActionScript to accommodate these features. In the next two sections, you will examine the processes of this application.

Examining the User's Experience

To understand the goals of the application, each step of the application you tested in the last section is outlined. By looking at the tasks the user performs to interact with the application, you can better understand how to build the Flash client movie and FlashCom application code.

As with any multimedia project, the ability to define the process of a user interface is critical. Don't attempt to build an interface in any authoring tool until you have a plan. Even the most basic plan can save you hours, if not days or weeks, of development work. Granted, it's much simpler to deconstruct an existing example than it is to describe or map a concept from scratch. Most developers and UI designers create mock-ups in graphic design programs such as Macromedia FreeHand or Fireworks. You can even create paper mock-ups, with simple sketches of each user interface (or screen) within the application.


Figure 13.4 illustrates the path a user takes to start a live conference session. This map begins to deconstruct the server-side operations within the Flash-Com application. The process involves two screens: a start screen where the user can specify a conference room and title, and a chat screen where the user can send and receive audio/video streams from another participant.

Figure 13.4Figure 13.4 The process flowchart of the conference recording client.


The process for the second user interface is shown in Figure 13.5. This Flash client movie allows the user to connect to a FlashCom application and choose a previously recorded conference session from a combo box. When the selection is made in the combo box, the AV streams are presented to the user.

Figure 13.5Figure 13.5 The process flowchart of the conference retrieval client.

Determining the Requirements

Now it's time to get down to brass tacks. You know what the application needs to do, but what factors do you need to consider to create such an application? What kind of application architecture do you need to construct that will allow several hundreds (if not thousands) of users to conduct chat sessions with one another?


One of the objectives of this conference application is the ability to host several two-way chats for many simultaneous users. Therefore, each conference session needs its own application instance, just as you saw in the multiroom text chat example in Chapter 11. The name of the conference room is used as the instance name for the FlashCom application.While the conference recording client is engaged with one instance of the application, the default instance ( _definst_ ) needs to be available for users who want to view previously recorded sessions. In the next section, you will learn how information recorded from each application instance can be accessible by the default instance of the FlashCom application.


As you will learn later in this chapter, the actual name of the FlashCom application is conference. This name is referenced in the rtmp URI used in client- and server-side ActionScript code.


The conference retrieval client can retrieve the information for any recorded session. The retrieval client connects only to the default instance of the conference application on the FlashCom server. Hence, each recording session needs to save its information in a common namespace. For the conference application, the default application instance ( _definst_ ) is designated as this namespace.

There are three persistent remote SharedObject instances created by server-side ActionScript for each recording session (or application instance). Each of these instances creates an FSO file stored in the sharedobjects/_definst_ folder of the conference application.

  • av_1_timeTracker_so: This SharedObject instance creates a file that stores the recording information of the first user's AV stream. The details of the recording information are discussed in the next section. The name of the SharedObject FSO file is based on the following formula:

    application instance name + "_" + stream number + "_" + current date 

    The instance name of the application is the same as the room name of the conference, and the stream number is either 1 or 2. The date information uses the following formula:

    year + "_" + month + "_" + day + "_" + hour + "_" + minute

    For example, if a person using the left AVPresence component in the Flash client movie connected to the application, the instance named family starts sending an AV stream on October 31, 2002 at 7:21 PM, and the FSO file will have the following name:

  • av_2_timeTracker_so: This SharedObject instance stores the recording information for the second user's AV stream. The second user is the person using the AVPresence component instance located on the right half of the Flash movie stage.

  • savedCalls_so: When each user has disconnected from an instance of the conference application (that is, when the application.clients.length property is less than 1 or equal to 0), the application instance stores the conference title, date (as established by the previous date formula), length (in milliseconds), and instance name. This information is saved as a new property name in the remote SharedObject file, savedCalls.fso, created by the instance. The name of this property uses the following formula:

    application instance name + "_" + current date 

    The information stored in the savedCalls data is loaded into the conference retrieval client as soon as it loads. When a user selects a conference title in the combo box, the appropriate time tracker data is loaded from the other two remote SharedObjects.

    Later in this chapter, you will learn about other temporary (non-persistent) remote SharedObject instances that are created to store other information used by the application instance.


    Later in this chapter, you will learn about other temporary (non-persistent) remote SharedObject instances that are created to store other information used by the application instance.

Each instance of the conference application also records streamed audio and video from the AVPresence components to stored FLV files. You will learn more about the specific server-side ActionScript code to record streams later in this chapter. For now, it's important to understand that you can create virtual locations for stored streams on a FlashCom server. By default, if you create or record a stream within a specific application instance, the FLV file for that stream is saved within an instance folder of the streams folder for your application. For example, if you record a stream with a connection to the default instance of the conference application, the stream is saved in the following location:


If a Flash client movie wants to play a stream located in this folder, then the client must connect to the default instance of the application. If the movie is connected to another instance, only streams for that instance can be played. However, an XML configuration file for your FlashCom server allows you to specify virtual locations for stored streams. On your FlashCom server, locate the Vhost.xml file. With a default Windows installation of Flash Communication Server MX, this file is located in the following folder:

C:\Program Files\Macromedia\Flash Communication Server MX\conf 

Open this XML file in Macromedia Dreamweaver MX or your preferred XML document editor. If you scroll down to the <VirtualDirectory> node, the inserted comments tell you that you can specify virtual locations for streams. Later in this chapter, you create the following virtual path in this node, which adds a callStream alias name to your server's configuration:



The actual folder name in the physical path does not need to have the same name as the alias itself. You must restart your FlashCom server to register any newly added aliases.


When you create a virtual directory for a stream alias, you must specify the format aliasName;path. You need to provide a name for the stream alias, followed by a semicolon ( ; ) and the full path to the directory you want to use. You can use network paths as well, such as \\myLocalServer\myShareName\myFolder.

By adding this node to the <VirtualDirectory> node, you can make references to the callStreams alias in the stream name of a NetStream.publish() or Stream.get() method. For example, once the callStreams alias is created, the following client-side code creates an FLV file named myRecording in the callStreams folder of the conference application, where nc represents a valid NetConnection object reference and myCamera represents a Camera object:

myStream_ns = new NetStream(nc);
myStream_ns.publish("callStreams/myRecording", "record");

Regardless of the application or application instance to which the nc object is connected, the myRecording.flv file is stored in the callStreams folder. This technique allows you to retrieve streams in the callStreams location from any application or application instance running on the FlashCom server. As such, you can create several common folders and aliases for streams, allowing you to save or play streams to and from other various locations, including networked drives.


As the Vhost.xml document's name suggests, stream aliases can be used by any application on the current virtual host domain of the FlashCom server. The Professional edition of FlashCom server allows one server to manage several virtual domains.

The intended purpose for saving SharedObject data in the _definst_ instance of the conference application and stream files to the callStreams alias is to enable the retrieval client movie to connect to just one application instance ( _definst_ ) to access information and streams for any recorded session. Regardless of the name of the application instance that was responsible for creating the session, the default instance of the application can access streams recorded by other application instances.


Most of the information stored in the three persistent remote SharedObjects mentioned in the previous section is created within the server-side Action-Script code of the conference application. Because a chat between two people occurs in real time, the application must track when each person begins publishing a stream and when that stream is stopped. This tracking (and subsequent saved data) is necessary for the chat to be replayed at a later time by the retrieval client.

In order to track the time, the application instance creates a property named startTime. This property is a Date object representing the time (in milliseconds) at which the first user clicks the Send audio/video text link within one of the AVPresence components—or more exactly, when the server first receives the stream from that user's client. The conference session's length and the specific recording times of each user's streams can be determined by subtracting startTime from a new Date object. The onStatus() handler of the server-side Stream objects is used to capture the start and stop "moments" of each user's stream. Each set of start and stop times is saved as a separate object within a recordTimes array stored in each user's respective time tracker SharedObject (discussed in the previous section). You will learn more about these specific operations later in this chapter.

The server-side ActionScript code of the conference application also borrows information from the temporary remote SharedObject that was created for the AVPres-ence components. Each of these objects stores the user's login name (as entered in the SimpleConnect component instance). The user's name is retrieved from the respective SharedObject and stored in the user's recordTimes array.


The FlashCom Component Framework was introduced in the last chapter. Many of the Communication Components create remote SharedObjects that allow the components to share information among connected users, application instances, and other Communication Components.

The recording client also provides a text field for the conference's title. This text is stored (and synchronized) via another temporary remote SharedObject named sessionName. Any time a user changes the text within the title field in the Flash client and clicks the Change button, a property named title within the sessionName data is updated. The value of the title property is saved in the savedCalls SharedObject at the end of the recorded session.


When the retrieval client movie first loads, the movie connects to the default instance ( _definst_ ) of the conference application. Once a successful connection is made, the movie connects to savedCalls, the persistent remote SharedObject created (or modified) during a recorded session. Each named property of this object represents a recorded session, and the value of each property is an object with several other properties describing details of the session. One of these properties, confTitle, stores the title of the session (this value is actually retrieved from the SharedObject named sessionName, discussed in the previous section). The confTitle property from each session is used as the label property for each item in the ComboBox instance displayed in the retrieval client movie. The data property of each item is set to the respective property name of the savedCalls remote SharedObject. When a user selects a session's title in the combo box, this data property is used to retrieve the appropriate tracker SharedObject data for each recorded stream.

When the data for each user's recorded session is retrieved, a setInterval() function recreates the same timing mechanism used in the server-side Action-Script code. When the elapsed time of the client movie matches the start time of either user's recording session, the movie begins to play the saved stream. When the elapsed time matches the stop point of a user's recording, playback on that stream is stopped.


During a recording session, a user can start or stop publishing as many times as he or she deems necessary. Each start and stop point is saved in the recordTimes array for each user.

Peachpit Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from Peachpit and its family of brands. I can unsubscribe at any time.


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about Peachpit products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information

To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.


Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites; develop new products and services; conduct educational research; and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.


If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information

Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.


This site is not directed to children under the age of 13.


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information

If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at and we will process the deletion of a user's account.


Users can always make an informed choice as to whether they should proceed with certain services offered by Adobe Press. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive:

Sale of Personal Information

Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to

Supplemental Privacy Statement for California Residents

California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure

Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact

Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice

We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020