This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
The Communication Classes
|
11
system. Multiple cameras and microphones can be accessed by the same Flash
movie. Only one video and audio stream can be published or played within a single
NetStream; however, there can be multiple NetStreams within a single NetConnec-
tion, as shown in Figure 1-4. The Flash Player is responsible for encoding all audio
and video data. Video encoding from each video source is currently limited to con-
stant bit rate encoding at a single resolution. The Camera and Microphone classes
can be used to control the amount of audio and video data being sent to the server
and can be dynamically adjusted to match the bandwidth limitations of the clients
connected to an application. No real-time hardware encoding options are currently
available, though that may have changed by the time you read this. Some video cards
can present different resolution video streams from the same input as separate video
sources so that multiple NetStream objects carrying different resolution video from
the same source can be published simultaneously. Otherwise, the only way to pro-
vide different streams matched to the bandwidth of each client is to use multiple
video sources.
The Camera class provides a convenient way to change the resolution, frame rate,
and quality settings for each video source. The Microphone class allows setting the
sampling rate, gain, and silence level, among others. A Video object is used to dis-
play video within a Flash movie and can be dynamically resized and moved as video
is played. See Chapter 6 for working examples.
Sharing Data in Real Time
Real-time applications often require data to be shared among or transmitted between
multiple movies. The SharedObject class is familiar to many Flash programmers as a
way to create a kind of supercookie; a local shared object (LSO) can store Action-
Script data on the client between sessions. Flash communication applications can use
remote shared objects (RSOs) to share information in real time between movies run-
ning on different clients. If a movie updates a property of a remote shared object, the
same property is updated in every other movie connected to it. When a shared object
changes, each client is notified of the changes. Shared objects can be used to:
Notify all the movies connected to a video conference application of the name of
every available live stream
Update the position of elements in a game
Figure 1-4. Attaching audio and video sources to a published stream and attaching a playing
stream to an embedded Video object to view incoming video
Client NetConnection Application instance
blesser
peldi
Client NetConnection Application instance
blesser
peldi

Get Programming Flash Communication Server now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.