Copy link to clipboard
Copied
We have an instance of AMS 5.0 Professional installed and we are trying to use it to republish our stream to YouTube. But after just a couple minutes of streaming the stream stops. Not seeing anything unusual in the log files. Below is a copy of the main.asc file.
// Called when the client publishes
application.onPublish = function(client, myStream) {
trace(myStream.name + " is publishing into application " + application.name);
if (application.name == "YouTube/_definst_"){
var nc = new Array();
var ns = new Array();
nc[0] = new NetConnection();
nc[0].connect( "rtmp://a.rtmp.youtube.com/live2" );
ns[0] = new NetStream(nc[0]);
ns[0].setBufferTime(2);
ns[0].attach(myStream);
ns[0].publish("pubpoint1", "live" );
ns[0].onStatus = function(info) {
trace("Stream Status: " + info.code)
if (info.code == "NetStream.Publish.Start") {
trace("The stream is now publishing to Primary YouTube.");
}
}
nc[1] = new NetConnection();
nc[1].connect( "rtmp://b.rtmp.youtube.com/live2?backup=1" );
ns[1] = new NetStream(nc[1]);
ns[1].setBufferTime(2);
ns[1].attach(myStream);
ns[1].publish("pubpoint1", "live" );
ns[1].onStatus = function(info) {
trace("Stream Status: " + info.code)
if (info.code == "NetStream.Publish.Start") {
trace("The stream is now publishing to Backup YouTube.");
}
}
nc[2] = new NetConnection();
nc[2].connect( "rtmp://cnmediav1.xxxxx.org/live" );
ns[2] = new NetStream(nc[2]);
ns[2].setBufferTime(2);
ns[2].attach(myStream);
ns[2].publish("livestream", "live" );
ns[2].onStatus = function(info) {
trace("Stream Status: " + info.code)
if (info.code == "NetStream.Publish.Start") {
trace("The stream is now publishing to Internal server.");
}
}
}
}
application.onUnpublish = function( client, myStream ) {
trace(myStream.name + " is unpublishing" );
}