TUTORIAL TO CREATE LIVE TV OF RECORDED VIDEO USING FLASH MEDIA SERVER


To Make live Tv Stream we need to use the media server. Here i am showing you how we can use flash media server to produce the recorded video to server as live tv channel.
 

flash media server 3

 
In order to broadcast to Live stream using Flash Media Server you will need to create the “Application to Flash Media Server”. You can create the new application in the flash media server by just creating the new folder like livestream. When we create the application then we can get the application url which starting from the rtmp. Like in the below url.

FMS URL: rtmp://fmsserverurl.com/livestream

it should be required to paste the other files application.xml which is used to configure the application related configuration application folder.

How do you create a Server Side Playlist for Flash Media Server that will play a list of files from a directory, e.g., a list of MP4 or F4v files?

You need to write the .asc file which will be hosted on the application folder of the fms hosted server.
First copy the main.asc file and than write the following script to create the playlist . This will be called the server side script playlist.

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

if(application.myStream)
{
application.myStream.play(“01”,0,-1,true);
application.myStream.play(“02”,0,-1,false)
application.myStream.play(“03”,0,-1,false)
}
}

When the application will start it will create the playlist with 3 videos, like 01.flv, 02.flv and 03.flv. In script you can see the 1 stream has true parameter means which play the video immediately and the 2 stream has the false it means it will wait to play video.

Also these all are video will be placed in the configuration media or stream folder which will be exists in the application folder.

you can find the more details about the server side stream class in the following link. This link will explain more which i was not provided here.

After this you need to create the client side code which will access the livestream in client side flash action script code using the NetConnection class. We can access the playlist using the Netstream class. Please find the following code.

var video:Video = new Video();
addChild(video);var nc:NetConnection = new NetConnection();
nc.connect(rtmp://fmsserverurl.com/livestream);var ns:NetStream = new NetStream(nc);
ns.client = {};
ns.client.onMetaData = ns_onMetaData;
ns.client.onCuePoint = ns_onCuePoint;
ns.play(“playlist”);
video.attachNetStream(ns);function ns_onMetaData(item:Object):void {
trace(“metaData”);
// Resize video instance.
video.width = item.width;
video.height = item.height;
// Center video instance on Stage.
video.x = (stage.stageWidth – video.width) / 2;
video.y = (stage.stageHeight – video.height) / 2;
}function ns_onCuePoint(item:Object):void {
trace(“cuePoint”);
trace(item.name + “\t” + item.time);
}

In above code i used the NetConnection and NetStream class to play the live stream from te server side playlist. Before you do this you need to study the details about this both class. You can find all details about those class in the below link.
This article is just provide the information about the creation of playlist and to connect the playlist. To know moLre details about the live implementation of the Live Tv Channel from Recorded Video or Live Broadcasting using the Flash Media Server please contact me.


Kalpesh Patel

Founder Of Nexus Software Group Leading IT solution and service provider and offering a full range of application development and I.T. consultancy services. Nexus Software Group Contributors In: post free ads online in India and post free ads online in USA