Architecture & DesignAdobe's Emerging Rich Media Ecosystem, Part 1: Developing Social Media Applications

Adobe’s Emerging Rich Media Ecosystem, Part 1: Developing Social Media Applications content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More.

There are three editions of Flash Media Server 3:

  • Flash Media Interactive Server: The full-featured edition of the server.
  • Flash Media Development Server: A development version of Flash Media Interactive Server. Supports all the same features but limits the number of connections.
  • Flash Media Streaming Server: Supports the live-video and video-on-demand streaming services only. This server edition does not support server-side scripting or stream recording.

This article will focus on a rich media ecosystem wherein connected participants can form communities that become participatory through the functionality found in the first two of these servers. An ecosystem is a system whose members interact with each other symbiotically (usually with synergistic outcomes). It is a term that originated from biology and refers to self-sustaining systems.

A follow-up article will focus on Flash Media Streaming Server and topics such as the H.264 video codec. And, later, a third article will discuss a number of additional topics such as security and service level agreements (SLAs). The topics chosen for the final article in this series reflect the fact that your eventual success in any media ecosystem can depend as much on technical savvy as business acumen.

You’ll need some familiarity with basic Adobe Flash technologies and products to follow these discussions. My recent article “Building Desktop Applications For The Web With Adobe Integrated Runtime” and the other references cited at the article’s end provide this background.

All three editions of the server can host streaming media applications, but Flash Media Interactive Server and Flash Media Development Server also can host social media and other real-time communication applications. Users can capture live audio and video, upload them to the server, and share the live content with other clients. This feature allows you to capture live events in real time and stream them to a large audience or create live audio and video conferences. When clients send live video to the server, you can give them the option of recording the video and storing it on the server. Applications that use this feature include video blogging and other social media applications that build user communities.

Note: You will need to use a media encoder to capture and stream live video to Flash Media Server. However, because Flash Media Server is supported only on Windows, you may want to create your own client that captures and streams live video.)

Flash Media Interactive Server and Flash Media Development Server also provide access to remote shared objects that synchronize data among many users, and so are also ideal for developing online games.

You can use Server-Side ActionScript to connect to other systems, including Java Enterprise servers, web services, and Microsoft .NET servers. This connectivity allows applications to take advantage of services such as database authentication, real-time updates from web services, and email. In addition to these advanced techniques, social media applications also can take advantage of the many video development techniques described in the Appendix.

Social media or social networking (one example of social media) has a number of characteristics that make it fundamentally different from traditional media such as newspapers, television, books, and radio. Social media describes the online technologies and practices that people use to share opinions, insights, experiences, and perspectives with each other.

Social media is created by using web content such as blogs and wikis and created by individuals or a collaboration of individuals called a community. A community, in this context, is a group of people with common interests who connect with one another to learn, play, work, organize and socialize. (See “Social Media Goes Mainstream” in the References section for more on this subject.) Communities can be large or small, local or global, and public or restricted to members. And, as you will see, social media often uses much of the same technology exploited by the developers of state-of-the-art games.

Client-Server Architecture

Flash Media Server (all three editions) is a hub. Applications connect to this hub using Real-Time Messaging Protocol (RTMP)—I’ll discuss the RTMT protocol in the next article of this series—and its variants and the server can send data to and receive data from many connected users. A user can capture live video or audio using a webcam or microphone that’s attached to a computer running Adobe Flash Player and publish it to a server that streams it to thousands of users worldwide.

An application that runs on Flash Media Server has a client-server architecture. The client application is developed in Adobe Flash or Adobe Flex and runs in Flash Player, AIR, or Flash Lite 3. It can capture and display audio and video and handle user interaction. The server application runs on the server. It manages client connections, writes to the server’s file system, and performs other tasks.

The client must initiate the connection to the server. Once connected, the client can communicate with the server and with other clients. More specifically, the client connects to an instance of the application running on the server. An example of an application instance is an online game with different rooms for various groups of users. In that case, each room is an instance.

Many instances of an application can run at the same time. Each application instance has its own unique name and provides unique resources to clients. Multiple clients can connect to the same application instance or to different instances.

Figure 1: Several clients connecting to multiple applications (sudoku and scrabble) and application instances (room 2, room 1, and room 2) running on Flash Media Server

Real-Time Collaboration Application Server

Flash Media Interactive Server and Flash Media Development Server include the same streaming services as Flash Media Streaming Server. In addition, they provide an SDK that lets developers write both the client-side and the server-side components of media applications to create interactive, two-way applications. These two servers also offer an SDK that lets developers write plug-ins in C++ to extend the core functionality of the server.

Hosting Multiple Applications and Application Instances

Flash Media Interactive Server and Flash Media Development Server can host an unlimited number of applications and an unlimited number of instances of each application.

Note: Flash Media Streaming Server can host an unlimited number of instances of the live video and video-on-demand services but is restricted to running applications provided by Adobe.

For example, Flash Media Interactive Server could host a web conferencing application, a video blogging application, a video chat application, and a multiplayer game, as well as the live video and video on demand services. You can create multiple instances of each of those applications. For example, use instances to give groups of people access to the same application without having the groups interact with each other, such as a video chat application with rooms for different topics.

Shared Objects

You use shared objects to synchronize users and store data. Shared objects can do anything from holding the position of pieces on a game board to broadcasting chat text messages. Shared objects let you keep track of what users are doing in real time. With Flash Media Interactive Server or Flash Media Development Server, you can create and use remote shared objects, which share data between multiple client applications. When one user makes a change that updates the shared object on the server, the shared object sends the change to all other users. The remote shared object acts as a hub to synchronize many users. To illustrate this concept, these two servers ship with a Shared Ball example—when any user moves the ball in his or her browser, all users see it move (see Figure 2).

Thus, users worldwide can participate in an online game, with all moves synchronized for all users. As stated above, online games are not the only kind of application that can exploit shared objects.

Note: Flash Media Streaming Server does not support remote shared objects.

Figure 2: The Shared Ball sample application

All editions of the server support local shared objects, which are similar to browser cookies. Local shared objects are stored on the client computer and don’t require a server. Shared objects, whether local or remote, can also be temporary or persistent:

  • A temporary shared object is created by a server-side script or by a client connecting to the shared object. When the last client disconnects and the server-side script is no longer using the shared object, it is deleted.
  • Persistent shared objects retain data after all clients disconnect and even after the application instance stops running. Persistent shared objects are available on the server for the next time the application instance starts. They maintain state between application sessions. Persistent objects are stored in files on the server or client.

Broadcast Messages to Many Users

And finally, a remote shared object allows either a client or server to send a message using SharedObject.send() to all clients connected to the shared object.


Video capture, storage, and transmission is gradually becoming more accessible, enabled by low-cost devices such as camcorders, mobile phones, webcams, free software, and falling broadband/storage costs. And, the creation and distribution of social media has become widespread due to the abundance of Internet technologies and new online media services (as explained in my recent article “From Web 2.0 and Enterprise 2.0 to Management 2.0,” these services are called “Enterprise 2.0” within the enterprise and “Web 2.0” elsewhere).

Social networking communities also can be an ongoing conversation with your consumers. By allowing them to upload their videos and share their thoughts and opinions about your brand, you are truly embracing Web 2.0. Your consumers often will share your brand message out into the world, bringing more people back to your community.

The looming economic downturn will inevitably lead to a decrease in ad spending, but marketers are likely to continue shifting money into social media, according to a new study by Forrester Research.

According to this report, marketer moves into areas like word of mouth, blogging, and social networking will withstand tightened budgets. In contrast, marketers are likely to decrease spending in traditional media and even traditional online vehicles geared to building brand awareness.

Today, companies are rapidly trying to keep pace with the social evolution and are finding out that social media applications are useful marketing tools. The financial incentive is there for a company to invest in an interactive server of the kind described above or to pay a third party to host one for them.


Connecting to the server—the NetConnection class

Before a client can play audio and video from Flash Media Server, it must connect to the server. The connection request is accepted or rejected by an application instance on the server, and connection messages are sent back to the client. Once the application accepts the connection request, a connection is available to both the client and the server.

Users connect to the server through a network connection (see Figure 3). A connection is similar to a large pipe and can carry many streams of data. Each stream travels in one direction and transports content between one client and the server. Each server can handle many connections concurrently, with the number determined by your server capacity.

Figure 3: Connecting to the server with the NetConnection class

Managing connections—connection status codes

Once the connection between client and server is made, it can break for various reasons. The network might go down, the server might stop, or the connection might be closed from the server or the client. Any change in the connection status creates a netStatus event, which has both a code and a level property describing the change.

Multiple bit rate switching

Adobe Flash Media Server can encode and deliver On2 V6 and Sorenson Spark-encoded video. Flash Player 8 and 9 support both codecs, whereas Flash Player 7 and earlier versions support only the Sorenson Spark codec.

You can create virtual directories on the server to store copies of video streams in each format. This lets your application deliver the highest quality content to clients based on their Flash Player version. The next article in this series will have more to say about codecs.

Detecting bandwidth

Matching a data stream to the client’s bandwidth capacity is perhaps the most important factor in ensuring a good playback experience. Once you have detected a user’s bandwidth, you can:

  • Choose a video encoded at a bit rate appropriate for the user’s bandwidth speed.
  • Play a video and set the buffer size based on the detected bandwidth.

In Adobe Flash Media Server, bandwidth detection is built in to the server. The new bandwidth detection, called native bandwidth detection, provides better performance and scalability. To use native bandwidth detection, make sure bandwidth detection is enabled, and write client code that calls functions built in to Adobe Flash Media Server.

With native bandwidth detection, you can use any version of ActionScript on the client. You do not need to add or change server-side code. If you prefer to use your existing server-side bandwidth detection code from a previous release of Flash Media Server, you can disable native bandwidth detection by configuring BandwidthDetection in Application.xml.

Detecting stream length

The server-side Stream class allows you to detect the length of a recorded stream. The Stream class has a static method, length(), that returns the length in seconds of an audio or video stream. The length is measured by Adobe Flash Media Server and differs from the duration that onMetaData returns, which is set by a user or a tool.

Buffering streams dynamically

Buffering a video stream helps ensure that the video plays smoothly, without interruption. Buffering manages fluctuations in bandwidth while a video is playing. These fluctuations can occur due to changes in a network connection or server load, or to additional work being done on the client computer.

To create the best experience for users, monitor the progress of a video and manage buffering as the video downloads. You may need to set different buffer sizes for different users, to ensure the best playback experience. One choice is to detect a user’s bandwidth.

While the stream is playing, you also can detect and handle netStatus events. For example, when the buffer is full, the netStatus event returns an info.code value of NetStream.Buffer.Full. When the buffer is empty, another event fires with a code value of NetStream.Buffer.Empty. When the data is finished streaming, the NetStream.Buffer.Flush event is dispatched. You can listen for these events and set the buffer size smaller when empty and larger when full.

Note: Flash Player 9 Update 3 no longer clears the buffer when a stream is paused. This allows viewers to resume playback without experiencing any hesitation. Developers also can use NetStream.pause() in code to buffer data while viewers are watching a commercial, for example, and then unpause the stream when the main video starts.


About the Author

Marcia Gulesian is an IT strategist, hands-on practitioner, and advocate for business-driven architectures. She has served as software developer, project manager, CTO, and CIO. Marcia is the author of well more than 100 feature articles on IT, its economics, and its management.

Get the Free Newsletter!

Subscribe to Developer Insider for top news, trends & analysis

Latest Posts

Related Stories