Copy link to clipboard
Copied
Well after all , thank you for your forum, here we go.
I was looking for about weeks to find the solution but now im stuck, even on your forum i didnt find enough informations about what i'm looking for. Ok , Whats My probleme? Well I need to restream an RTMP,but no informations available or far away from what i want.
If i do have controle of the RTMP link? No (but its only for education) so i want to perform into.
Im jalouse that wowza community they offer this solution to their users even if you dont have any controle of the server , you need only the link of the rtmp and the playpath and put them into rtmp.stream
So i would like to get some more informations on how it works with FMS 4 Thank You , sorry for my english. a Frensh guy here
Copy link to clipboard
Copied
Hi,
Your query is not clear. What do you mean by restream? What are you trying to do here?
Copy link to clipboard
Copied
Hi Thank you for your repley.
Well lets say i have a link : rtmp://server-ip/stream (i dont have any controle on it). So i would like to restream it with flash media server 4, to get a link like rtmp://myserver-ip/mystream
Copy link to clipboard
Copied
This can be achieved using server side play of the 1st stream and then publish that stream.
So, you can write an server side app in which you make connection to rtmp://server-ip/given_app and then after successful connection, you can do server side play of the stream. When you receive NetStream.Play.Start status then you can publish that stream.
Following is the sample code:
nc=new NetConnection();
nc.connect("rtmp://server-ip/given_app");
nc.onStatus=function(evt){
if(evt.code=="NetConnection.Connect.Success"){
streamObj=Stream.get("foo");
streamObj.play(stream_name);
streamObj.onStatus=function(info){
if(info.code=="NetStream.Play.Start"){
ns=new NetStream(nc);
ns.attach(streamObj);
ns.publish(stream_name);
ns.onStatus=function(obj){
if((obj.code=="NetStream.Publish.Start")){
trace("Publish Started");
}
}
}
}
}
}
Copy link to clipboard
Copied
Thank you chandan for your answer. So the code that you gave me should I put it in /application/live/application.xml???
Copy link to clipboard
Copied
Hi,
There was some problem with the above code. You can copy paste the below code in file main.asc. It is working code.
application.onAppStart = function() {
application.myRemoteConn = new NetConnection();
application.myRemoteConn.onStatus = function(info){
trace("Connection to remote server status " + info.code + "\n");
if(info.code=="NetConnection.Connect.Success"){
application.myStream = Stream.get(<mystream_name>);
application.myStream.onStatus = function() {
}
if (application.myStream){
application.myStream.play(<stream_name>, 0, -1, true, application.myRemoteConn);
}
}
};
// Use the NetConnection object to connect to a remote server.
application.myRemoteConn.connect("rtmp://<server-ip>/<app_name>");
}
Copy link to clipboard
Copied
Hi Chandan but i still stuck.
Here we Go.
1-Stream from Server A to Server B
2-Server A I dont Have any controle on it
3-I controle Only the server B
4-If the code that you gave me works for my situation so where to put it?
Thank you
Copy link to clipboard
Copied
Hi,
I guess you at least know the app name and stream name on server A. So, in the above code, replace
<server-ip> with Server IP
<app_name> with Server A application name
<stream_name> with Server A stream name
<mystream_name> with the stream name you want to publish.
Now, create an applicaton on Server B. Copy the code and paste in the file named "main.asc" and then copy this in the created apps folder.
Copy link to clipboard
Copied
ok i got it, now main.asc comes with some code, so should i removed it and place your code ?
Copy link to clipboard
Copied
up up plz
Copy link to clipboard
Copied
You will have to create new application, you can name it anything and you can then create blank main.asc inside that applications folder. You can then put Chandan's code insidet that main.asc. Mind you Chandan has given only piece of code - but even then his code in its own should work as per me.