FLVplayblack
hi,
i'm trying to use this code but i can't to access to function nc.onFCSubscribe. how can i do it? someone know about that?¿ the original site of the code is http://www.flashcomguru.com/index.cfm/2009/8/14/flvplayback-obtain-nc-reference
thanks.
// listen to player events and kill manual connection once we're streaming
player.addEventListener("playing", playListener);
player.addEventListener("stateChange", stateListener);
player.addEventListener("ready", readyListener);
/* this is the hack: check once every frame if the NC has been defined inside the FLVPlayback component */
this.onEnterFrame = function()
{
if (player.ncMgr.getNetConnection() != undefined)
{
this.onEnterFrame = null;
delete this.onEnterFrame;
trace("got NC");
subscribe(streamName);
}
}
var nc:NetConnection;
var serverName:String = "server.llnwd.net";
var appName:String = "account_name/_definst_";
var streamName:String = "live";
var source_Str = "rtmp://" + serverName + "/" + appName + "/" + streamName;
// start up by setting the contentPath (now called source in newer versions of the component)
player.contentPath = source_Str;
function subscribe(name:String)
{
nc = player.ncMgr.getNetConnection();
nc.onFCSubscribe = function(info:Object)
{
trace("onFCSubscribe: " + info.code);
clearInterval(int_id);
if (info.code == "NetStream.Play.StreamNotFound")
{
// handle error, retry after a few secs or similar }
else if (info.code == "NetStream.Play.Start")
{
// we're successfully subscribed }
else
{
// handle error }
};
// not used right now
nc.onFCUnsubscribe = function(info:Object)
{
}
trace("subscribing to " + name);
nc.call("FCSubscribe",null,name);
}
// can be used to unsubscribe from stream
function unsubscribe(name:String)
{
nc.call("FCUnsubscribe",null,name);
}
