Copy link to clipboard
Copied
I have created the client-server application to switch streams and republish them as single continious stream to the remote server. I republish additional stream (myStream) by NetStream.publish() methode In the server-side script (main.asc).
This is fragment of the long script:
nc = new NetConnection(); nc.connect( "rtmp://remoteserver/live" ); ns = new NetStream(nc); ns.onStatus = function(info) { trace("Stream Status: " + info.code) if (info.code == "NetStream.Publish.Start") { trace("The stream is now publishing"); } } ns.setBufferTime(2); ns.attach(myStream); ns.publish("livestream", "live"); |
Unfortunately, republishing push-stream "livestream" vanishes soon in some minute after start.
Is it possible to make push stream more stable one?
Are there any methodes?
Copy link to clipboard
Copied
I will investigate and get back to you.
Copy link to clipboard
Copied
I used the follwoing server side code.
test1 application has the following main.asc and test2 is a blank application.
test1 - main.asc
application.onConnect = function(clientObj){
trace("application.onConnect");
application.acceptConnection(clientObj);
}
application.onPublish = function(clientObj,streamObj){
trace("application.onPublish");
nc = new NetConnection();
nc.onStatus = function ( obj ){
trace("NC : >>>>> "+obj.code);
if(obj.code == "NetConnection.Connect.Success"){
ns = new NetStream(nc);
ns.attach(streamObj);
ns.onStatus = function(statusObj){
trace("NS : >>>>> "+statusObj.code);
}
ns.publish("livestream","live");
}
}
nc.connect("rtmp://localhost/test2");
}
> I published a stream named "livestream" to test1. It republished to "test2" with stream name "livestream".
> I played back the "livestream" from "test2" application.
> After a while I stopped publishing to test1 and the playback stopped from "test2".
> When I did republish ( i.e started publishing again with same stream name ) to "test1", "test2" playback resumed.
Copy link to clipboard
Copied
I did it too, but my push-stream disappear on the romote server in some minutes after start without any messages in my local server logs.
Is there any diagnostics and stable republishing mode for this case?
Copy link to clipboard
Copied
In your second application - you can have handlers application.onPublish() and application.onUnpublish() defined and put some trace statements - this will help you identify if stream is getting unpublished at second application because of some reason. In addition - you can onConnect handlers too so that you can see if application is getting disconnect or something.
Copy link to clipboard
Copied
I've got the same problem.
Any sollution??