In this tutorial we will be explaining how to use the VideoPlayBack
component without the simpleConnect component.
You have probably noticed that if the simpleConnect component is used that
somebody must login to the app before being able to use it. This example will show you how to overcome this slight problem.
Please keep in mind that for streaming video to work with Flash
Communcation Server the file must be in FLV form. This can be done either by recording with Flash Communication Server or taking a video file and changing it with a software like Sorenson Squeeze. You can even import it into FlashMX and then export it as flv.
For this tutorial you will need at least the developer version of Flash
Communication Server and the installation of the Communcation Components which can both be downloaded from the Macromedia site.
start off, open up a new file and add a layer. As in the picture change
the names of the layers to reflect what will be in them. This is just
good practice when it comes to developing good apps in Flash.
In the video layer's first frame place the VideoPlayback Component
give it an instance name of video_cc. The instance name can be anything really but putting an ending of _cc gives it meaning in the script for the human eye as a Communcation Component.
In the parameters for this component delete the entry 'video' from the
Default Stream Name. Even though when we set the video later in Actionscript deleting this isn't important yet just good practice.
Click on the actions layer's first frame and open up the actions panel.
Switch over to Expert mode if you are not already there and type in:
This will set the video for the first video to play in the VideoPlayback
component. This must be the name of the FLV file that we will be placing
on the server, without the extension of flv.
Next create a new NetConnection called my conn using this script:
This is the line that will connect the VideoPlayback Component to the
server to retrieve the video. This line takes the place of the connect
line that is in the simpleConnect component. The trace can be taken out later
as this is really only used for debugging.
The last line consists of the connection line. For everybody this will
different. In my line here I have set my local network server as the
connecting server. The application name is "video_player" and the instance of this application is "video".
Now we will move on to the server side of things. Make a directory in the
applications directory called "video_player".
NOTE: because we are using a component we will need to include the
main.asc file that has "load ("components.asc");
In there create a directory called "streams". In here we will
the video file under a the instance directory. In this case we named the
instance "video" so we will place the flv files inside there.
Play your movie and the video should show up in the VideoPlayback
component on the stage. That's all there is to it.