18.3. Playing Flash Video
Problem
You want to play streaming or progressive-download Flash Video content.
Solution
Code your own playback interface or use the FLVPlayback component.
Discussion
You can display Flash Video in your Flash projects by building your own interface and writing ActionScript to load the video. The general process to building a simple Flash Video player involves these steps:
Add a Video object to the library of your Flash document, and place an instance of that Video object on the stage.
In the Actions panel, create
NetConnectionandNetStreamobjects. If your Flash Video resides on a web server, specify the URL to the .flv file in the NetStream.play( ) method. If your Flash Video resides on a Flash Communication Server, Flash Media Server, or Flash Video Streaming Service (FVSS) provider account, specify the RTMP location of the application in the NetConnection.connect( ) method and the FLV (without the .flv extension) in the NetStream.play( ) method.Add
ButtonorMovieClipinstances to act as play, stop, or pause buttons that control the playback of the video file.
To build a simple playback for progressive-download FLV files, follow these steps:
Create a new Flash document in Flash 8.
In the Library panel, click the Options menu in the top right corner and choose New Video. In the Video Properties dialog box, set the Type option to Video (ActionScript-controlled). Name the symbol whatever you prefer, and click OK.
Rename layer 1 to Video. On frame 1 of this layer, ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access