O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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.

Table of Contents

  1. Table of Contents
  2. Foreword
  3. 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
  4. Part I
  5. 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. Building the user interface
        2. Setting up the NetConnection and showing its status
        3. Making the connection
        4. Showing remote users
      3. Hello Video! Summary
    9. Conclusion
  6. 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
  7. 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
    7. Communication Components Without SimpleConnect
      1. Creating the Application on the Server
      2. Building the Client
    8. Conclusion
  8. 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
  9. Part II
  10. 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. NetStream.Buffer.Empty
        2. NetStream.Seek.Notify
      11. 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
  11. 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. Working with modes
        2. Working with quality
        3. Working with keyframes
        4. Working with activityLevel
    3. Building a Message-Taking Application
    4. Building a Surveillance Application
    5. Conclusion
  12. 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
  13. Part III
  14. 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
    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
  15. 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. 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
  16. Server Management API
    1. Connecting to the Admin Service
    2. Using the Server Management API
      1. Application Methods
      2. Instance Methods
      3. Server Methods