23 May 2007
A basic working knowledge of Flash Media Server and either Flash CS3 Professional or Dreamweaver CS3.
Beginning
For the world of Flash video, the year 2007 opened with a bang when Adobe released Flash Media Live Encoder. Adding Flash Media Live Encoder to Adobe's product line makes Flash video web broadcasts of live events even easier and of the highest supported quality. Best of all, Flash Media Live Encoder is free to Flash Media Server licensees or users with Flash Video Streaming Service accounts.
This article provides a quick overview of how to set up a live webcast using Flash Media Live Encoder and Flash Media Server.
Since its inception, Flash Media Server has supported live video and audio streaming. Now adding Flash Media Live Encoder for encoding live web broadcasts offers two important benefits: the highest quality video supported, and quicker, easier deployment.
Flash Media Live Encoder directly delivers the highest quality supported video by using On2 VP6 encoding. Previously, this was only possible through the use of third-party solutions. Flash Media Live Encoder provides quicker, easier deployment by being a fully featured acquisition and encoding application that natively integrates with Flash Media Server. Previously, the acquisition and encoding functionality had to be custom-coded using the Flash authoring tool.
This article provides a basic overview of using Flash Media Server, Flash Media Live Encoder, and either Flash CS3 Professional or Dreamweaver CS3 to create a live web broadcasting application. Figure 1 presents each of these in context with the other elements of a basic live broadcast.
The elements of the basic live broadcast illustrated in Figure 1 are as follows:
The following sections step you through configuring Flash Media Server using Flash Media Live Encoder, and creating a playback SWF file.
Flash Media Server offers a unique combination of traditional scalable streaming media capabilities and a flexible development environment for creating and delivering innovative, interactive media applications to the broadest possible audience. This article focuses solely on Flash Media Server's live streaming capabilities.
This article assumes that you have Flash Media Server installed and running locally. The application setup is the same whether the server is running locally or remotely. You can use any version of Flash Media Server for this task, including the free Developer Edition.
If you do not already have Flash Media Server installed, download it and follow the documentation to install it. To see a video tutorial covering the installation of Flash Media Server 2 on Windows as well as Linux, check out Train Simple videos: Introduction to Flash Media Server 2 in the Flash Media Server Developer Center.
To create a Flash Media Server application for your live video stream, do the following:
Note: Make sure that there are no typos in your subdirectory name. Hereafter, this subdirectory name is your Flash Media Server application name, and it will be referred to both in configuring the Flash Media Live Encoder and in authoring your playback SWF file. The spelling in each case must match exactly.
For Dreamweaver users, the required main.asc file can be found in the following Dreamweaver directory:
[drive]:\Program Files\Adobe\Adobe Dreamweaver CS3\configuration\Templates\Video_Player
If you are still using Flash Professional 8, you can find the required main.asc file here:
[drive]:\Program Files\Macromedia\Flash 8\Samples and Tutorials\Samples\Components\FLVPlayback
Note: These versions of main.asc contain logic required by components that you will be using to author the playback SWF file in a later section. In Flash Media Server, files with .asc extensions denote files that contain server-side ActionScript logic.
application.onConnect function. You may find the line p_client.writeAccess, which prevents live streaming from happening by default. If you see it, be sure to comment out this line as follows:application.onConnect = function(p_client, p_autoSenseBW)
{
//Add security here
//p_client.writeAccess = ""; // prevents creating shared object or live streams.
this.acceptConnection(p_client);
if (p_autoSenseBW)
this.calculateClientBw(p_client);
else
p_client.call("onBWDone");
}
That's all the setup required of you on the server side. Before proceeding to the next section, make sure that Flash Media Server is running.
Flash Media Live Encoder is designed to enable live event producers to capture audio and video and stream it live to Flash Media Server or the FVSS.
The intuitive user interface of Flash Media Live Encoder works seamlessly with plug-and-play cameras and microphones, and compatible analog-to-digital converters. Flash Media Live Encoder produces live Flash video with On2 VP6 encoding, delivering high-quality footage with size and bit rate flexibility. You also get full audio control with the bit-rate efficient Nellymoser audio codec.
Flash Media Live Encoder installs just like a regular desktop application. Currently Flash Media Live Encoder is available only for Windows XP. To make sure that your computer can run Flash Media Live Encoder, review the system requirements.
To help you get oriented to the Flash Media Live Encoder interface, Figure 2 highlights the Flash Media Live Encoder's main sections.
Following is a key with descriptions for the numbered sections in Figure 2:
Note: For a full description of all Flash Media Live Encoder's features, review the in-product help. You can access the help from the main menu by selecting Help > Flash Media Live Encoder Help.
To configure Flash Media Live Encoder to send your first live stream:
Make sure that there are no typos in your FMS URL. This URL is specifying the real-time messaging protocol, followed by host name (localhost), application name (myLiveApp), and creating an instance name (instance1). In the next section, when you create playback SWF files, you will reference this URL and must match the spelling exactly.
Tip: If your Flash Media Server is on a server other than localhost, update the FMS URL here accordingly, along with all following instructions referencing localhost.
Note: Ensure that there are no typos in your stream name. In the next section when you create playback SWF files, you will reference this stream and must match the spelling exactly.
Note: If an error is returned, double-check all the previous steps in both this section and in the prior section.
At this point your stream is live! Now all you need is an audience.
The next section covers creating a playback SWF file you can publish on your website that your audience can download to connect to the live stream. Before proceeding to the next section, however, make sure that Flash Media Live Encoder is started and streaming.
A key to the power of using Flash video for your live events is the ubiquity of Adobe Flash Player, one of the most widely installed pieces of software in the world.
You have several options for creating Flash playback SWF files so your audience can view live broadcasts from Flash Media Live Encoder and Flash Media Server. This article looks at two: using Dreamweaver CS3 and using Flash CS3 Professional with the FLVPlayback component.
Note: When you test the playback SWF files, if everything is working correctly, the video being streamed by Flash Media Live Encoder should appear almost immediately. If the video being streamed does not appear within 15 or 30 seconds, double-check all the steps for creating the playback SWF file and the steps in the prior sections on Flash Media Server and Flash Media Live Encoder. If the video still does not appear, the layer behind it (if any) will show through. This is true if either Flash Media Server or Flash Media Live Encoder are not started. This is also true if there is any error in configuring the FLVPlayback component at author time.
The Flash video component in Dreamweaver CS3 helps you easily insert and display Flash video in your websites. It's great for Dreamweaver users who are not familiar with Flash because you can insert Flash video into your web pages without using the Flash authoring tool.
To use Dreamweaver CS3 to create a playback SWF file for your audience to use to view the live stream being published from the Flash Media Live Encoder:
Note: Make sure there are no typos in the values in either your Server URI or stream name. These values must exactly match values previously set in configuring both Flash Media Server and Flash Media Live Encoder.
You can now customize your HTML page as your requirements demand and publish the resulting files to your website. In addition to myLiveVideo.htm, your directory now contains two SWF files and a copy of main.asc. When publishing to your website, you must copy the HTML and SWF files together!
Regarding the main.asc file, for this article you copied a duplicate of main.asc earlier in the section on configuring Flash Media Server. When you publish to a production server, the contents of this main.asc file must be included in the main.asc file in the application directory on your production server.
Note: If there already is a main.asc file on your production server, be sure to check with your Flash Media Server administrator before possibly overwriting any existing main.asc file.
Flash CS3 Professional includes the FLVPlayback component, which makes it easy to insert and display Flash video in your websites. Flash CS3 includes both ActionScript 2.0 and ActionScript 3.0 versions of FLVPlayback. The ActionScript 2.0 version is the same FLVPlayback component that shipped with Flash Professional 8. The ActionScript 3.0 version is new with Flash CS3 Professional and includes support for Flash Player 9 features such as full-screen video on playback. For users who are familiar with the Flash CS3 authoring tool, the FLVPlayback components enable you to use Flash video with minimal or no ActionScript code.
Here I cover creating a playback SWF file with both the ActionScript 2.0 and ActionScript 3.0 versions of the FLVPlayback components.
Here's how you use Flash CS3 and the ActionScript 2.0 FLVPlayback component to create a playback SWF file for the live stream being published from the Flash Media Live Encoder:
Note: When entering the contentPath value, the Content Path dialog box shown in Figure 5 will open. In the dialog box, deselect both options.
You can now customize your SWF file as your requirements demand, embed it in an HTML page, and publish the resulting files to your website.
To use Flash CS3 and the ActionScript 3 FLVPlayback component to create a playback SWF file for the live stream being published from the Flash Media Live Encoder:
Note: When entering the contentPath value, the Content Path dialog box shown in Figure 7 will open. In the dialog box, deselect both options.
You can now customize your SWF file as your requirements demand, embed it in an HTML page, and publish the resulting files to your website.
Note: The ActionScript 3.0 FLVPlayback component supports a degree of styling through the properties skinBackgroundColor and skinBackgroundAlpha.
This article demonstrates how easy it is to add live video to websites using Flash Media Server, Flash Media Live Encoder, and a playback SWF file authored in either Dreamweaver CS3 or Flash CS3 Professional.
If you are interested in going beyond single-camera webcasts, see Kevin Towes' article on Building a live video switcher with Flash Communication Server MX. (Flash Media Server was previously known as Flash Communication Server MX.)
If you are interested in customizing the Flash ActionScript 2.0 FLVPlayback component, read Creating custom video controller skins for the Flash video component in Dreamweaver 8 by Jen deHaan and also Customizing the FLVPlayback component by Dan Carr. To customize the latest Flash video controllers and provide unique user interfaces for navigating through movie content, check out Dan Carr's article, Skinning the ActionScript 3.0 FLVPlayback component.
If you are interested in either authoring a custom playback SWF file (that is, not using the FLVPlayback component) or—for live webcasts—using the acquisition and encoding functionality built into the Flash Player (that is, not using Flash Media Live Encoder), see Stefan Richter's article, Building a simple live video broadcaster and receiver.
Note: The acquisition and encoding functionality built into Flash Player encodes video using the Sorenson Spark codec. The quality of video encoded using the Sorenson Spark codec is generally considered not to be of the same quality as video encoded using the On2 VP6 codec. You can see side-by-side comparisons of recorded video encoded using the two codecs at FlashVideoFAQ.com. Playback SWF files can mix streams encoded using both codecs. You can also learn about comparing different encoding software to find what's most appropriate for your Flash video needs in Elliot Mebane's article, Selecting a Flash video encoder.
Here are some additional resources for studying Flash Media Server:
Tutorials & Samples |