NetStream.publish for P2P NetGroup fails in the FMS 4.0 AS
Hi,
I recently tried to modify the system-provided codes in the "multicast" folder, and could not get it work. I pinned down the issue to be the function call NetStream.publish("p2p_pindao1", "live") always failed for me. The proof the function call failed including:
1. The returned value is false.
2. I got no further events beyond NetStream.Connect.Success, i.e. I did not get the expected NetStream.Publish.Start
The following are the testing codes
application.onAppStart = function()
{
var nc = new NetConnection();
nc.onStatus = testNetStatus;
nc.connect("rtmfp://localhost/TVLive");
trace("to connect");
}
function testNetStatus(info)
{
trace("TestNetStatus:" + info.code);
var gs = new GroupSpecifier("net.lysk.pindao1");
gs.serverChannelEnabled = true;
gs.postingEnabled = true;
gs.peerToPeerDisabled = false;
// Multicast address over which to exchange peer discovery.
//var p2pm = "224.0.0.255:30000"; // BUGBUG
// Must be enabled for LAN peer discovery to work
//gs.ipMulticastMemberUpdatesEnabled = true;
var ng = new NetGroup(this, gs);
ng.objNc = this;
ng.objGs = gs;
ng.onStatus = testNetGroupStatus;
}
function testNetGroupStatus(info)
{
trace("testNetGroupStatus:" + info.code);
var ns = new NetStream(this.objNc, this.objGs);
ns.onStatus = testNetStreamStatus;
}
function testNetStreamStatus(info)
{
trace("testNetStreamStatus:" + info.code);
if (info.code == "NetStream.Connect.Success")
{
if(!this.attach(Stream.get("mp4:sample1_1000kbps.f4v")))
trace("can not attach");
if (!this.publish("testpublish", "live"))
trace ("can not publish");
}
}
tracing outputs are the following:
to connect
TestNetStatus:NetConnection.Connect.Success
testNetGroupStatus:NetGroup.Connect.Success
testNetStreamStatus:NetStream.Connect.Success
can not publish
Your help in solving the problem will be highly appreciated.
Thanks.
