Copy link to clipboard
Copied
Hi guys,
we are streaming 24/7 live from a number of FMLE's to FMS Interactive server to a livepkgr cloned app., and to our clients we stream both to Flash via rtmp and to iOS via HLS.
Since we want to introduce another server (to be able to serve more clients), the question is - hot to republish from one to another server so that both servers can stream rtmp and hls to clients?
We are already using the backup url in FMLE to stream to a backup server - this we do not want to change since the backup server is just that - backup, if the main server fails.
Could someone point me to a SSAS sample code that will do this (and work inside livepkgr existing main.asc which we did not change, except the "append" parameter which is changed to "record")?
I will suggest.
1. Create a app. Name it say ingestapp. Place a main.asc
application.onPublish = function(client, myStream) {
trace(myStream.name + " is publishing into application " + application.name);
// This is an example of using the multi-point publish feature to republish
// streams to another application instance on the local server.
// republishing to first server
trace("Republishing the stream into livepkgr1/_definst_");
nc1 = new NetConnection();
nc
...Copy link to clipboard
Copied
I will suggest.
1. Create a app. Name it say ingestapp. Place a main.asc
application.onPublish = function(client, myStream) {
trace(myStream.name + " is publishing into application " + application.name);
// This is an example of using the multi-point publish feature to republish
// streams to another application instance on the local server.
// republishing to first server
trace("Republishing the stream into livepkgr1/_definst_");
nc1 = new NetConnection();
nc1.connect( "rtmp://localhost/livepkgr1" );
ns1 = new NetStream(nc1);
// called when the server NetStream object has a status
ns1.onStatus = function(info) {
trace("Stream Status: " + info.code)
if (info.code == "NetStream.Publish.Start") {
trace("The stream is now publishing");
}
}
ns1.setBufferTime(2);
ns1.attach(myStream);
ns1.publish( myStream.name, "live" );
// next server
trace("Republishing the stream into livepkgr2/_definst_");
nc2 = new NetConnection();
nc2.connect( "rtmp://localhost/livepkgr2" );
ns2 = new NetStream(nc2);
// called when the server NetStream object has a status
ns2.onStatus = function(info) {
trace("Stream Status: " + info.code)
if (info.code == "NetStream.Publish.Start") {
trace("The stream is now publishing");
}
}
ns2.setBufferTime(2);
ns2.attach(myStream);
ns2.publish( myStream.name, "live" );
}
application.onUnpublish = = function(client, myStream)
{
ns1.attach(false);
ns2.attach(false);
}
(You can write much better managed code .. It is just a sample)
2. Create two livepkgr application , livepkgr1 .. livepkgr2 .. In above code I assumed both are on same server, though you may change the server and keep the livepkrg application name same.
3. From FMLE, instead of publishing to livepkgr, publish to ingestapp .. else keep everything same.
4. From client subscribe to livepkgr1 and livepkgr2 and to correct server..
so in this case, FMLE feed to ingest app and ingest app work as feeder to multiple livepkgr applications.. Hope this clarifies..
Regards.
Copy link to clipboard
Copied
Thank you Sir.
I'll try this when the time comes...