Copy link to clipboard
Copied
Hi,
For long i been using wowza server, recently i change my platform to FMIS, I want to know how to restream a RTMP url
in wowza
1. i create a folder name edge on application folder and conf folder.
2. i have a folder name content, i just have to create a myStream.stream file
3. then paste my rtmp://remote-ip/live/stream link to myStream.stream file.
then i can play the file rtmp://wowza-ip/edge/myStream.stream in any rtmp player.
how can i do such a thing on adobe FMIS.
Thank you
No i had not given complete - i thought you'll get the hint - sorry for my assumption
You will add similar code in application.onPublish
client.ns1 = new NetStream(nc1);
client.ns1.onStatus = function( info )
{
trace("ns1: " + info.code);
if ( info.code == "NetStream.Publish.Start")
{
client.ns1.attach(stream);
}
}
if (client.ns1)
{
client.ns1.publish(stream.name);
}
Copy link to clipboard
Copied
Hi Sandy,
There are basically three ways in FMS you can restream an existing stream from another server.I will let you know 3 of them and explain one of them briefly and you can let me know if you want more details related to it and first of all if i got your question or use case right.
Three ways you can restream are:
You can find details about each of them in our documentation.
I will explain first method i.e. multi-point publish.
So basically you have two server namely ServerA and ServerB.
You publish your content on ServerA and using multi-point publish you push it to another application on ServerB.
So basically is brief way how do you do it:
Create a folder in application directory of ServerA - name it app_1. Create main.asc inside app_1 folder and put following code in it:
NetConnection.prototype.connectTimer;
NetConnection.prototype.url;
NetConnection.prototype.onStatus = function( info )
{
trace ("##### nc: " + info.code + " #####");
if (info.code == "NetConnection.Connect.Failed" || info.code == "NetConnection.Connect.Closed")
{
if( this.connectTimer )
{
clearInterval(this.connectTimer);
this.connectTimer = null;
}
trace("setting up reconnect timer for " + this.url);
this.connectTimer = setInterval(reconnect,30000, this);
}else{
if(info.code == "NetConnection.Connect.Success" )
{
trace("************************** connection to " + this.url + " successful ");
if( this.connectTimer ){
clearInterval(this.connectTimer);
}
}
}
}
reconnect = function ( nc )
{
if(nc.connectTimer)
{
clearInterval(nc.connectTimer);
nc.connectTimer = null;
}
nc.connect(nc.url);
}
application.onAppStart = function()
{
nc = new NetConnection();
nc.url = "rtmp://serverB/app_2";
nc.connect(nc.url);
}
application.onPublish = function(client, stream)
{
trace("##### Publish: " + stream.name + " #####");
client.ns = new NetStream(nc);
client.ns.onStatus = function( info )
{
trace("ns: " + info.code);
if ( info.code == "NetStream.Publish.Start")
{
client.ns.attach(stream);
}
}
if (client.ns)
{
client.ns.publish(stream.name);
}
return true;
}
application.onUnpublish = function(client, stream)
{
trace("##### Unpublish: " + stream.name + " #####");
client.ns.attach(false);
client.ns.publish(false);
}
Now create a folder called "app_2" in applications directory of ServerB. Create main.asc inside app_2 and put below code in it:
application.onPublish = function(client, stream)
{
trace("OnPublish triggered for:"+stream.name);
}
application.onUnpublish = function(client, stream)
{
trace("OnUnublish triggered for:"+stream.name);
}
Now open your publisher client and publish stream by any name.
You will see that same stream is republished on second server on ServerB with same name on application "app_2". You can check by subscribing to the stream on app_2
let me know if you any queries.
Copy link to clipboard
Copied
Hi,
SE_0208 your script work well, how do i add another server to the main server
current one is nc.url = "rtmp://serverB/app_2";
how do i add a nother server (serverC)
, which means main server restream to 2 edge servers
Copy link to clipboard
Copied
Its simple, just create one more NetConnection object say nc1 and write relevant code.
nc1 = new NetConnection();
nc1.url = "rtmp://serverC/app_2";
nc1.connect(nc1.url);
Copy link to clipboard
Copied
Hi
SE_0208
So does the middle of the code should be like below. (i have no experiance on Action Script, do i use {} for the neew code too)
application.onAppStart = function()
{
nc = new NetConnection();
nc.url = "rtmp://serverB/app_2";
nc.connect(nc.url);
nc1 = new NetConnection();
nc1.url = "rtmp://serverC/app_2";
nc1.connect(nc.url);
}
application.onPublish = function(client, stream)
{
trace("##### Publish: " + stream.name + " #####");
client.ns = new NetStream(nc);
client.ns.onStatus = function( info )
Copy link to clipboard
Copied
No i had not given complete - i thought you'll get the hint - sorry for my assumption
You will add similar code in application.onPublish
client.ns1 = new NetStream(nc1);
client.ns1.onStatus = function( info )
{
trace("ns1: " + info.code);
if ( info.code == "NetStream.Publish.Start")
{
client.ns1.attach(stream);
}
}
if (client.ns1)
{
client.ns1.publish(stream.name);
}
Copy link to clipboard
Copied
Thank you, it works