How to Stream to Adobe server and Relay to Wowza, HTML 5 portal with Apps

Follow

When you need the power of multiple services.

You have an Adobe Server application and would like to use the record feature in your portal for live streams.

1. In your portal create a live stream name. Check the auto record option to the right.

2. In your FMSapps folder create a new application instance.

3. use the code below and change the following line.

rtmpid.live.cloud.influxis.com/rtmpid/stream to match the stream name provided in your portal.

4. Save the file as main.asc

5. Log into your FMS admin console within your portal and restart your server.

When you publish to the Adobe server your streams will also be published to the Wowza server and all recorded files will be saved in your Source Content folder ready to be encoded for mobile delivery.

 

//relay
load('InfluxisStream.asc');
//
var relayPathCollection = [
'rtmp://rtmpid.live.cloud.influxis.com/rtmpid/stream',

];

var relay_obj = {};
//
application.onAppStart = function()
{
application.relay_streams = {};
};
application.onPublish = function( p_client, p_stream )
{

p_client.pubName = String( p_stream.name );
//RELAY
if(!application.relay_streams[p_stream.name])
{


application.relay_streams[p_stream.name] = new InfluxisStream();
application.relay_streams[p_stream.name].index = 0;
application.relay_streams[p_stream.name].addEventListener( 'change', onRelayStreamEvents );

relay_obj.source = p_stream;
relay_obj.path = relayPathCollection[application.relay_streams[p_stream.name].index];
relay_obj.relayname = String( p_stream.name );
trace(relay_obj.path + " / " + relay_obj.relayname)
application.relay_streams[p_stream.name].connect( relay_obj );
}else
{
application.relay_streams[p_stream.name].connect(relay_obj);
}

application.relay_streams[p_stream.name].publishing = true;
};
application.onUnpublish = function( p_client, p_stream )
{
if(application.relay_streams[p_stream.name])
{
application.relay_streams[p_stream.name].disconnect();
}

application.relay_streams[p_stream.name].publishing = false;
};
application.onDisconnect = function( p_client )
{
delete application.relay_streams[p_client.pubName];
}
application.onAppStop = function()
{
delete application.relay_streams;
};
//
function onRelayStreamEvents( p_object )
{
trace( 'onRelayStreamEvents:: ' + p_object.code + ' -- ' + p_object.target.publishing);

switch(p_object.code)
{
case 'CONNECTED':
trace(application.relay_streams[p_object.target.relayname].path);
break;
case 'DISCONNECTED':
if(!p_object.target.publishing)return;
application.relay_streams[p_object.target.relayname].index++
if(application.relay_streams[p_object.target.relayname].index >= relayPathCollection.length )
{
application.relay_streams[p_object.target.relayname].index = 0;
}
application.relay_streams[p_object.target.relayname].path = relayPathCollection[application.relay_streams[p_object.target.relayname].index];
application.relay_streams[p_object.target.relayname].connect();
break;
case 'FAILED':
break;
case 'RELAYING':

break;
case 'RELAY_STOPPED':
break;
}
}

 

 

 

Have more questions? Submit a request

Comments

  • Avatar
    Kaif

    Hi,

    Thanks for this post but i cant find anything in the source content folder. When i investigated then i saw an some error in admin console. I dont know what it is:

    Sending error message: C:\Applications\FMS\scriptlib\InfluxisStream.asc: line 94: ReferenceError: disconnectStream is not defined
    _onCDNServerEvents: NetConnection.Connect.Closed
    onRelayStreamEvents:: DISCONNECTED -- true
    __onCDNServerEvents: NetConnection.Connect.Success
    rtmp://obz9y7.live.cloud.influxis.com/obz9y7/testingHttpStream
    onRelayStreamEvents:: CONNECTED -- true
    _
    onCDNStreamEvents: NetStream.Connect.Success

    Below is the steps which i am following :
    1. I have created a live stream (testingHttpStream) and checked the auto record.

    1. Created a folder videorecorder in FMSAPP.

    2. Change the code to rtmp://obz9y7.live.cloud.influxis.com/obz9y7/testingHttpStream in main.asc.

    main.asc file is in videorecorder folder.

    4.Restarted the FMS server.

    please suggest where i am doing wrong.

    Regards,
    Kaif

Powered by Zendesk