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.
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.
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.
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);
}