Programming Flash Communication Server

Book description

With the advent of Flash Communication Server MX (FCS), Macromedia believes that it's on the edge of a breakthrough in how people think about the Internet. FCS has been designed to provide web developers with the means to add polished interactive audio and video features to their sites, the sort of features that users have come to expect. Naturally, the process of efficiently integrating rich media into applications, web sites, and web content is a complex one, to say the least. That's where Programming Flash Communication Server factors in. As the foremost reference on FCS, it helps readers understand how FCS can facilitate:

  • Video on demand

  • Live webcasts

  • Video chat and messaging

  • Shared desktop conferences

  • Live auctions

  • Interactive whiteboard presentations

  • Workflow collaboration

  • Multi-user games

Programming Flash Communication Server not only explains how to use the pre-built FCS components to construct a simple application, it also explains the architecture so that developers can program custom components to make even more advanced applications. In addition, the book explains how to truly optimize performance, and talks about considerations for networked applications as well as the media issues pertaining to FCS. Programming Flash Communication Server gives developers a sorely needed leg up on this potentially intimidating technology. It lets users develop cool web applications ranging from direct dating experiences with real-time video, to pre-recorded corporate presentations, to news services with video and audio, and much more. At last, the ability to build web sites with rich interactive features--minus the complex downloads and installation hassles--is a reality. And now, with Programming Flash Communication Server from O'Reilly by your side, you can do more quickly and easily than you ever dreamed possible.

Publisher resources

View/Submit Errata

Table of contents

  1. Table of Contents (1/2)
  2. Table of Contents (2/2)
  3. Foreword
  4. Preface
    1. What Does FlashCom Offer?
    2. What’s in This Book?
    3. How to Use This Book
      1. Part I: FlashCom Foundation
      2. Part II: Audio, Video, and Data Streams
      3. Part III: Remote Connectivity and Communication
      4. Part IV: Design and Deployment
    4. Audience
    5. ActionScript 1.0 Versus ActionScript 2.0
    6. Server-Side ActionScript
    7. The flash-communications.net Site
    8. Director, Breeze, and Other Options
    9. Flash Video Options
      1. Embedded Video
      2. Progressive Download
      3. Streaming Video with FlashCom
    10. Licensing and Hosting Options
    11. Conventions Used in This Book
    12. Voice
    13. Using Code Examples
      1. Getting the Code Examples Working
    14. Safari Enabled
    15. Comments and Questions
    16. Acknowledgments
  5. Part I
  6. Introducing the Flash Communication Server
    1. Clients and Servers
    2. Creating an Application
    3. Real-Time Messaging Protocol
      1. FlashCom Versus Traditional Media Servers
    4. The Communication Classes
      1. Connecting to the Server
      2. Streaming Audio, Video, and ActionScript Data
      3. Camera, Microphone, and Video
      4. Sharing Data in Real Time
      5. Client and Application Objects
      6. Remote Methods
    5. Communicating with Application Servers, Databases, and Directory Servers
    6. Firewalls and Security
    7. Getting Started
      1. Admin Service, Administration Console, and App Inspector
    8. Hello Video!
      1. Setting Up helloVideo on the Server
      2. Building the helloVideo Client in Flash (1/2)
      3. Building the helloVideo Client in Flash (2/2)
        1. Building the user interface
        2. Setting up the NetConnection and showing its status
        3. Making the connection
        4. Showing remote users
      4. Hello Video! Summary
    9. Conclusion
  7. Communication Components
    1. Overview of Communication Components
      1. Server-Side Requirements
      2. Common Methods of the Communication Components
        1. init( )
        2. connect( )
        3. close( )
        4. onUnload( )
        5. setUsername( )
    2. Summary of Communication Components
      1. AudioConference
        1. Nested Flash UI components
        2. Component process overview
      2. AVPresence
        1. Client-side component parameters
        2. Component process overview
      3. Chat
        1. Nested Flash UI components
        2. Component process overview
        3. Configurable server-side attributes
      4. ConnectionLight
        1. Client-side component parameters
        2. How the component works
        3. Enabling ConnectionLight without SimpleConnect
      5. Cursor
        1. How the component works
      6. PeopleList
        1. Nested Flash UI components
        2. Component process overview
      7. PresentationSWF
        1. Nested Flash UI components
        2. Client-side component parameters
        3. Component process overview
      8. PresentationText
        1. Nested Flash UI Components
        2. Client-side component parameters
        3. How the component works
      9. RoomList
        1. Nested Flash UI components
        2. Client-side component parameters
        3. Component process overview
      10. SetBandwidth
        1. Nested Flash UI components
        2. Client-side component parameters
        3. Component process overview
      11. SimpleConnect
        1. Nested Flash UI components
        2. Client-side component parameters
        3. How the component works
      12. UserColor
        1. Nested Flash UI components
        2. How the component works
      13. VideoConference
        1. Nested Flash UI components
        2. Client-side component parameters
        3. Component process overview
      14. VideoPlayback
        1. Nested Flash UI components
        2. Client-side component parameters
        3. Component process overview
      15. VideoRecord
        1. Nested Flash UI components
        2. Client-side component parameters
        3. Component process overview
      16. Whiteboard
        1. Nested Flash UI components
        2. How the component works
    3. Creating an Application that Monitors a Connection
      1. Making the FlashCom Application Folder
      2. Building the Flash Client Movie
    4. Building a Simple Chat Room
    5. Adding Audio and Video to the Chat Room
    6. Forgoing the SimpleConnect Component
      1. Building the Client Movie
    7. Conclusion
  8. Managing Connections
    1. Making a Connection
      1. Absolute URIs
        1. Protocol
        2. Host and port
        3. Application name
        4. Instance name
      2. Relative URIs
      3. Waiting to Connect
    2. Managing a Connection
      1. Dealing with Success
      2. Dealing with Problems
      3. Closing the Connection from the Client
      4. Using a Connection
    3. Reusing a NetConnection Object
    4. Multiple Simultaneous NetConnection Objects
    5. Testing and Debugging Network Connections
      1. Test Client Movies
      2. Using the NetConnection Debugger
    6. Subclassing the NetConnection Class (1/2)
    7. Subclassing the NetConnection Class (2/2)
    8. Communication Components Without SimpleConnect
      1. Creating the Application on the Server
      2. Building the Client (1/2)
      3. Building the Client (2/2)
    9. Conclusion
  9. Applications, Instances, and Server-Side ActionScript
    1. Scripting Application Instances
      1. Instances and Resources
      2. Resource Name Collisions
    2. Differences Between Flash ActionScript and Server-Side ActionScript
      1. Case-Sensitivity
      2. Working with Inheritance
      3. Single Execution Context
      4. Accessing Undefined Variables
      5. try/catch/finally Statements
      6. #include and import Versus load( )
    3. The Life of an Application Instance
      1. Startup
      2. Midlife
      3. Shutdown
    4. Running a Simple Hello World Test Script
      1. application.onAppStart( )
      2. application.onStatus( )
      3. application.onConnect( )
      4. application.onDisconnect( )
      5. application.onAppStop( )
      6. Using the App Inspector to Run Scripts
    5. A More Realistic Example
      1. Authenticating and Customizing Clients
        1. Using the Client.prototype object
      2. Limiting the Number of Client Connections
      3. Performing Periodic Updates with setInterval( )
    6. Instance-to-Instance Communications
    7. Script Filenames and Locations in Detail
      1. The main Application Script File
      2. Using load( ) to Include Other Script Files
        1. Dynamically loading script files
    8. Testing and Debugging Server-Side Script Files
      1. Organizing Test Scripts
    9. Designing Communication Applications
    10. Conclusion
  10. Part II
  11. Managing Streams
    1. A Simple Publisher/Subscriber Example
      1. Publishing a Live Stream
      2. Subscribing to a Live Stream
    2. Stream Names
    3. Publishing Streams in Detail
      1. onStatus( ) handlers
      2. Attaching and Detaching Audio and Video Sources
      3. Bandwidth and Performance Problems
      4. Buffering When Publishing
      5. Snapshots, Stop Motion, and Time-Lapse Video
    4. Playing Streams in Detail
      1. Playing Live or Recorded Streams
        1. Creating playlists
      2. Stream Time
      3. Playback Events
      4. Playing MP3 Files
      5. Uploading Prerecorded Streams
      6. Buffering When Subscribing
      7. Detecting the End of the Stream
      8. Seeking Within a Stream
      9. Pausing and Unpausing a Stream
      10. Putting the User in Control (1/2)
      11. Putting the User in Control (2/2)
        1. NetStream.Buffer.Empty
        2. NetStream.Seek.Notify
      12. Managing Bandwidth
        1. Shutting off audio or video
        2. Capping client bandwidth usage
        3. Conferences and bandwidth
    5. The Stream Class
      1. Getting a Recorded Stream’s Length
      2. Republishing with Stream Objects
        1. Server-side playlists
        2. Switching streams
        3. Chaining streams
        4. Recording streams
      3. Deleting Streams
        1. Deleting an FLV file with a NetStream object
        2. Deleting an FLV file with a Stream object
        3. Deleting MP3 and FLV files with the application object
    6. Publishing and Playing ActionScript Data
      1. Defining a Remote Method
      2. Sending a Request
        1. Stream logs
        2. Sending and recording events
    7. Creating Synchronized Presentations
      1. Adding Closed Captions
      2. Adding Synchronized Slides
    8. The NetStream and Stream Information Objects
    9. Stream Enhancements and Limitations
      1. Server-Side send( ) Enhancements
      2. Sound Performance
      3. ActionScript 2.0
      4. Synchronization Limitations
    10. Conclusion
  12. Microphone and Camera
    1. Working with Microphone/Audio Input
      1. Getting the Microphone/Audio Input
      2. Understanding Microphone Permissions
      3. Detecting the Microphone Privacy Setting
      4. Attaching and Publishing Audio
      5. Adjusting Microphone Settings
        1. Working with gain
        2. Working with rate
        3. Working with activity level
        4. Working with echo management
    2. Working with Camera Input
      1. Getting Camera Input
      2. Understanding Camera Permissions
      3. Attaching and Publishing Video
      4. Adjusting Camera Settings (1/2)
      5. Adjusting Camera Settings (2/2)
        1. Working with modes
        2. Working with quality
        3. Working with keyframes
        4. Working with activityLevel
    3. Building a Message-Taking Application (1/2)
    4. Building a Message-Taking Application (2/2)
    5. Building a Surveillance Application
    6. Conclusion
  13. Media Preparation and Delivery
    1. Audio and Video Compression
      1. The Sorenson Spark Codec
        1. Constant bit rate (CBR) compression
        2. Variable bit rate (VBR) compression
      2. The Speech Codec
      3. Prerecorded Versus FlashCom-Recorded Media
      4. The Screen Recording Codec
    2. Converting Prerecorded Material to FLV Format
      1. Recompressing Video Files
      2. Using Flash MX 2004 to Create FLV Files
      3. Exporting Video from QuickTime Player Pro with the FLV Exporter
      4. Optimizing Media with Sorenson Squeeze
      5. Creating Media with Wildform Flix Pro
    3. Using Flash Pro’s Media Components
      1. MediaPlayback Component
      2. MediaController and MediaDisplay Components
    4. Enabling Multiple Bit Rate FLVs Within an Application
      1. Preparing the FLV Files
      2. Configuring the FCS Application
      3. Providing an Interface to Select and Switch the Streams
    5. Streaming MP3 Audio
      1. Considerations for MP3 Playback
      2. Using the MediaPlayback Component to Play MP3 Files
    6. Conclusion
  14. Part III
  15. Shared Objects
    1. Objects and Shared Objects
    2. Getting a Shared Object in Flash
      1. Getting and Using a Local Shared Object
      2. Getting and Using a Remote Shared Object
        1. Private versus shared data
      3. Updating Objects and Arrays in Shared Object Slots
      4. onSync( ) and Managing Change
      5. Yet Another Shared Ball Example (1/2)
      6. Yet Another Shared Ball Example (2/2)
    3. Updates and Frame Rates
    4. Scripting Shared Objects on the Server
      1. Server-Side onSync( )
      2. Locking a Shared Object
      3. Clearing a Shared Object
      4. Checking the Size of a Shared Object
    5. Temporary and Persistent Shared Objects
      1. Synchronizing Temporary and Persistent Shared Objects
      2. Clearing and Deleting Persistent Shared Objects
      3. Locally and Remotely Persistent Shared Objects
      4. Using flush( ) to Write to a Persistent Shared Object
      5. Resynchronization Depth
    6. Proxied Shared Objects
      1. Lobby and Chat Room Example
    7. Shared Objects and Custom Classes
    8. Avoiding Collisions
    9. Optimizing Shared Object Performance
    10. Broadcasting Remote Method Calls with send( )
      1. Text Chat Example
      2. Differences Between Shared Objects and NetStream.send( )
    11. A Simple Video and Text Chat Application
      1. Designing with Shared Objects
    12. Conclusion
  16. Remote Methods
    1. Why Use Calls?
    2. The send( ) and call( ) Methods
    3. Client-to-Server Calls
      1. Simple call( ) Example: “Server, Limit My Bandwidth”
      2. Other Parameter Types
      3. Result Object Example: “Server, What Time Is It?”
      4. Another Example: “Server, How Long Is This Stream?”
      5. Client.method Versus Client.prototype.method
    4. Server-to-Client Calls
      1. Simple call( ) Example: “Client, Here’s Your ID”
      2. Contacting Clients
        1. Looping through the clients array
      3. Using a Result Object: “Client, Are You OK?”
    5. Server-to-Server Calls
    6. A Simple Lobby/Rooms Application
      1. Using the Same Application Folder for the Lobby and Rooms
      2. The Lobby
        1. The client-side lobby.as code
        2. The server-side lobby.asc code
      3. The Room Application (1/2)
      4. The Room Application (2/2)
        1. The client-side room.as code
        2. The server-side room.asc code
    7. Debugging Calls
      1. The Communication App Inspector Is Your Best Friend
        1. Error: msg sent before connection established
      2. Debugging Server-to-Server Calls
      3. Trapping onStatus Whenever Possible
    8. Advanced Topics
      1. Passing Variable Numbers of Arguments
      2. Making Calls Without Waiting for connect( )
      3. Reusing Result Objects
      4. Calling obj1/obj2/method and obj1.obj2.method
      5. Routing Remote Calls Through a Common Function
      6. Using a Façade Method on the Server-Side
      7. __resolve( ) and apply( )
      8. Using call( ) and send( ) together
      9. Using application.registerProxy( )
      10. Passing Objects as Parameters
    9. Conclusion
  17. Server Management API
    1. Connecting to the Admin Service
    2. Using the Server Management API (1/2)
    3. Using the Server Management API (2/2)
      1. Application Methods
      2. Instance Methods
      3. Server Methods
        1. broadcastMsg()
        2. Other server-related methods
      4. Configuration API Methods
    4. Server Management API Uses
      1. Monitoring a FlashCom Server
      2. Polling Room Statistics
      3. Subscribing to the Log Streams
    5. Conclusion
  18. Flash Remoting
    1. The Remoting Gateway
    2. Remoting Basics
      1. Remoting Classes (1/2)
      2. Remoting Classes (2/2)
        1. Google web service
        2. Services
        3. Methods
        4. Handling results
        5. Handling errors
      3. Passing Datatypes
        1. Custom classes
        2. Recordsets
      4. Action Message Format
    3. Role of Remoting in FlashCom Applications
    4. Securing Access
    5. Conclusion
  19. ColdFusion MX and FlashCom
    1. Understanding ColdFusion MX and Flash Remoting
      1. Using CFML and ColdFusion Components
      2. Using Flash Remoting with ColdFusion
        1. Determining the Flash Remoting gateway URL
        2. Determining the service address
        3. Calling the service method
        4. Passing parameters to a service method
        5. Handling return values
    2. Using Flash Remoting to Log Events
      1. Setting Up the Database
      2. Creating the Logger Class
      3. Creating the CFC
      4. Building the FlashCom Application
      5. Creating the Flash Client
      6. Viewing the Events
    3. Getting a List of Streams
      1. Setting Up the Streams
      2. Creating the CFC
      3. Writing the FlashCom Application
      4. Making the Streams Client
    4. Using ColdFusion and FTP to Mirror Streams
      1. Creating a Stream Manager
      2. Creating an FTP Server Class
      3. Using ColdFusion with FTP
      4. Making the FlashCom Application
      5. Creating the Publishing Client
    5. Conclusion
  20. Part IV
  21. Building Communication Components
    1. Source Files
    2. People Lists
    3. A Simple People List
      1. Building the Component (1/2)
      2. Building the Component (2/2)
        1. Building the graphical interface
        2. Tying the list to the shared object
    4. Listenable Shared Objects
    5. Status and People List
      1. Designing and Building the Status Component (1/3)
      2. Designing and Building the Status Component (2/3)
      3. Designing and Building the Status Component (3/3)
        1. Building the client-side Status component
        2. Building the server-side Status object
      4. Designing and Building a PeopleList Component
    6. Text Chat
      1. Text Chat Resources and Messaging
        1. TextChat message passing
        2. TextChat history
        3. TextChat message parsing
      2. Text Chat User Interface
      3. Connecting the User Interface and Shared Object
      4. Chat History
    7. Shared Text (1/2)
    8. Shared Text (2/2)
    9. Video Conference and Video Window (1/2)
    10. Video Conference and Video Window (2/2)
      1. Publishing
      2. Playing
    11. PeopleGrid (1/2)
    12. PeopleGrid (2/2)
    13. Summary
    14. Conclusion
  22. Understanding the Macromedia Component Framework
    1. The Component Framework
    2. Under the Hood of the Chat Component
      1. The Server-Side Code
      2. The Client-Side Code
      3. Enhancing the Chat: Creating MyChat
      4. Changing MyChat: Turning Off the Chat History
      5. Enhancing MyChat: Adding Special Commands
    3. Creating a Simple Component from Scratch: SharedTextInput
      1. The .fla File
      2. The Client-Side Class File
      3. The Server-Side Code
      4. A Sample Application That Uses SharedTextInput
    4. Creating a Container Component: SharedAddressForm
      1. The .fla File
      2. The Client-Side Code
      3. The Server-Side Code
      4. Using the SharedAddressForm Component
    5. Creating an Authenticating Component
      1. The Tester Application: AuthConnectTest
        1. The client side of AuthConnectTest
        2. The server side of AuthConnectTest
      2. The Client Side of AuthConnect
      3. The Server Side of AuthConnect
      4. A Sample CFC to Use with AuthConnect
    6. Integrating Components with Your Existing Applications
      1. The onConnectAccept and onConnectReject Events
      2. Referencing a Component Instance in main.asc
      3. Server-Side Events
    7. Understanding the Framework
      1. The Framework’s Files
      2. The Framework’s Data Structures
        1. Everything is based on a naming scheme
        2. The gFrameworkFC.components data structure
        3. The Client.prototype data structures
      3. The Framework’s Memory Management
      4. How Components Are Registered and Instantiated
      5. The Framework’s Method Routing
      6. The Framework’s Code
        1. Analyzing components.asc
        2. Analyzing framework.asc
        3. Analyzing application.asc
        4. Analyzing facade.asc
        5. Analyzing component.asc
    8. Conclusion
  23. Application Design Patterns and Best Practices
    1. Shared Object Management
      1. One-to-One Owner/SharedObject Relationships
        1. Connecting and reconnecting
      2. One-to-Many Owner/Listeners Relationships
      3. Delegating Updates (1/2)
      4. Delegating Updates (2/2)
      5. Slot Owners
      6. Update Sequence Options
      7. Interval Update Checks
      8. Populating Lists and DataGrids (1/2)
      9. Populating Lists and DataGrids (2/2)
        1. The __ID__ update problem
        2. Improving List and DataGrid update performance
    2. Moving Code to the Server
    3. Building Façades on the Server
    4. Server-Side Client Queues
    5. A Framework for Recording and Playing Back Componentized Applications
      1. What’s Covered in This Section
      2. The PTextField Component
        1. The tester.fla file
        2. The tester.as file
        3. The main.asc file
        4. The PTextField.as file
        5. The PTextField.asc file
      3. The Recording and Playback Framework APIs
        1. The recording APIs
        2. The playback APIs
      4. Updating the Tester Application
        1. Client-side code
        2. Server-side code
      5. Making PTextField Recordable
      6. Making PTextField Replayable
      7. The Recording and Playback Framework Implementation
        1. The client-side framework (PRecorder.as)
        2. The server-side code (PRecorder.asc)
    6. Components and Component Frameworks
      1. Yet Another Component Framework?
      2. The PFCSComponent Base Classes (1/2)
      3. The PFCSComponent Base Classes (2/2)
      4. The PFCSFramework Classes
    7. Conclusion
  24. Building Scalable Applications
    1. Coordinating Instances
      1. Managing Independent Instances
      2. Interinstance Communications (1/3)
      3. Interinstance Communications (2/3)
      4. Interinstance Communications (3/3)
        1. Proxies
    2. Scalability and Load Balancing
      1. Media-on-Demand
        1. Client-side server selection
        2. Software server selection
        3. Network-level server selection
      2. One-Way Live Delivery
        1. Source clients
        2. Root server application instance
        3. Intermediate server instances
        4. Leaf server application instances
        5. Destination clients
      3. n-Way Live Communications
      4. Redundancy and Failover
    3. Conclusion
  25. Network Performance, Latency, and Concurrency
    1. Latency
      1. Measuring Latency
      2. Clock Synchronization
    2. Bandwidth
      1. Adapting to Bandwidth
      2. Measuring Bandwidth (1/2)
      3. Measuring Bandwidth (2/2)
      4. Latency, Bandwidth, and Performance (1/2)
      5. Latency, Bandwidth, and Performance (2/2)
        1. Latency and SharedObject updates
    3. Concurrency
      1. Serializing Requests and the ActionScript Thread
      2. Asynchronous Callbacks
      3. Latency and Application State
      4. Living in the Future
    4. Conclusion
  26. Securing Applications
    1. The Three A’s: Authentication, Authorization, and Accounting
    2. Authentication
      1. Network or Packet Sniffing
      2. One-Time Ticket Systems (1/4)
      3. One-Time Ticket Systems (2/4)
      4. One-Time Ticket Systems (3/4)
      5. One-Time Ticket Systems (4/4)
        1. Requesting a ticket
        2. Generating a ticket and returning user information
        3. Authenticating against directory servers
        4. Connecting to FlashCom with a ticket
        5. Checking the ticket and returning user information
        6. Authentication in FlashCom
        7. One-time ticket systems summary
      6. One-Time Hash Systems (1/2)
      7. One-Time Hash Systems (2/2)
        1. Connecting twice with Flash
        2. Managing connection attempts in FlashCom
      8. Single Sign-On
        1. Web applications and portals
        2. Flash Remoting with FlashCom logins
      9. Checking Connection Information (1/2)
      10. Checking Connection Information (2/2)
        1. IP checks
        2. Referrer checks
        3. Agent checks
      11. Some Warnings and Caveats
        1. Flash Remoting
        2. Anonymous connections
    3. Authorization
      1. Role-Based Authorization (1/3)
      2. Role-Based Authorization (2/3)
      3. Role-Based Authorization (3/3)
        1. Component-level authorization
        2. Implementing component-level authorization
        3. Granting temporary access
      4. Role-Based Remote Method Access
      5. Fine-Grained Access Controls
      6. Access Control Tables
      7. Anonymous Access Restrictions
    4. Accounting
      1. Server-Level Logging
        1. Access logs
        2. Bandwidth logs
        3. Collecting FlashCom Server logs
      2. Application-Level Logging
    5. Suggestions and References
    6. Conclusion
  27. About the Authors
    1. Brian Lesser
    2. Giacomo “Peldi” Guilizzoni
    3. Joey Lott
    4. Robert Reinhardt
    5. Justin Watkins
  28. Index (1/5)
  29. Index (2/5)
  30. Index (3/5)
  31. Index (4/5)
  32. Index (5/5)

Product information

  • Title: Programming Flash Communication Server
  • Author(s): Brian Lesser, Giacomo Guilizzoni, Joey Lott, Robert Reinhardt, Justin Watkins
  • Release date: February 2005
  • Publisher(s): O'Reilly Media, Inc.
  • ISBN: 9780596005047