Server side stream caching
Hi,
I have a problem with server side caching on FMS (3.5.3).
I've taken the live main.asc and modified it in order to record streams on the server with timestamp names.
as follows:
/*
* application.onAppStart:
* is called when application load. It contains Live (out of the box)
* application specific initializations.
*/
load("AkamaiFCSPublish.asc");
application.onAppStart = function()
{
...
trace("...loading completed.");
application.streams = new Object();
}...
/*
* FCPublish :
* FME calls FCPublish with the name of the stream whenever a new stream
* is published. This notification can be used by server-side action script
* to maintain list of all streams or also to force FME to stop publishing.
* To stop publishing, call "onFCPublish" with an info object with status
* code set to "NetStream.Publish.BadName".
*/
Client.prototype.FCPublish = function( streamname )
{
/*
// setup your stream and check if you want to allow this stream to be published
if ( true) // do some validation here
{ // this is optional.
this.call("onFCPublish", null, {code:"NetStream.Publish.Start", description:streamname});
}
else
{
this.call("onFCPublish", null, {code:"NetStream.Publish.BadName", description:streamname});
}*/
var p_stream = Stream.get(streamname);
trace("FCPublish stream: "+p_stream.name);
td = new Date();
var recordname = p_stream.name + "_" + td.getFullYear()+"-"+(td.getMonth()+1<10?"0":"")+(td.getMonth()+1)+"-"+(td.getDate()<10?"0":"")+td.getDate()+"_"+(td.getHours()<10?"0":"")+td.getHours()+"-"+(td.getMinutes()<10?"0":"")+td.getMinutes()+"-"+(td.getSeconds()<10?"0":"")+td.getSeconds();
//Start recording
if (application.streams[p_stream.name])
{
s = Stream.get(application.streams[p_stream.name]);
s.record(false);
s = null;
}
application.streams[p_stream.name] = "mp4:"+recordname+".f4v";
s = Stream.get(application.streams[p_stream.name]);
if (s)
{
trace ("recording local file: "+application.streams[p_stream.name]);
s.record();
s.play(p_stream.name);
s.onStatus = function (info){
trace("streamrecinfo "+info.code+" "+info.description);
}
}
}
/*
* FCUnpublish :
* FME notifies server script when a stream is unpublished.
*/
Client.prototype.FCUnpublish = function( streamname )
{
// perform your clean up
//this.call("onFCUnpublish", null, {code:"NetStream.Unpublish.Success", description:streamname});
trace("onUnpublish stream: "+streamname);
s = Stream.get(application.streams[streamname]);
if (s)
{
if (!s.record(false))
{
trace("Could not stop recording "+application.streams[streamname]);
}
else
application.streams[streamname]= null;
s = null;
}
else
{
trace("Could not stop recording2 "+application.streams[streamname]);
}
}...
I use FMLE (3.1) to stream to the server and all works fine when i have only 1 stream going at one only time.
Now when i have several clients streaming to my server, the new client will stop the old client recording after a minute or so.
very strange.
I'm hoping someone could help me because this does not make sense. tracing doesnt even flag the fact that the stream is stopping recording.
Thank you
