SERVER SIDE PLAYLIST FOR FLASH MEDIA SERVER

To create the server side script on the flash media server we need to use the Stream class. So we need to some knowledge about this classes  before I write the server side script.

The Stream class lets you manage or republish streams in an application.
A Stream object is the server-side equivalent of the client-side NetStream object.

You can’t attach audio or video sources to a Stream object; you can only play and manage existing streams. Use the Stream class to shuffle existing streams in a playlist, pull streams from other servers, and control access to streams. You can also record streams published by a client and record data streams such as log files.

The important method is here we need to ware for this is the play() method which will play the stream of already recorded video or live stream. But here we need to create the server side playlist so we will use the recorded video file in flv,mp4 or f4v format. Please find the following link to know more about the play method of the stream class.

Refer Site for more details about Stream.play()

To create server side playlist then we need to start the streaming for the video when application start. Application start will immediately start after the creation of the application folder when we restart the flash media server without restart it will not affect updated files.

application.onAppStart = function()
{
 
application.myStream = Stream.get(“playlist”);

if(application.myStream)
{
application.myStream.play(“first”,0,-1,true);
application.myStream.play(“second”,0,-1,false)
application.myStream.play(“third”,0,-1,false)
}
}

Please note that if we use the flv then we no need to add the extension for the flv other wise we need to change the other syntex for the f4v and mp4. You can find the syntax for the mp4 file below.

application.onAppStart = function()
{
 
application.myStream = Stream.get(“playlist”);

if(application.myStream)
{
application.myStream.play(“first”,0,-1,true);
application.myStream.play(“mp4:second.mp4”,0,-1,false)
application.myStream.play(“third”,0,-1,false)
}
}

In above example after completion of the first.flv fiv stream class automatically start to play the next file second.mp4

Leave a Reply

Your email address will not be published. Required fields are marked *