Skip to main content
Participant
May 20, 2011
Question

NetStream.publish for P2P NetGroup fails in the FMS 4.0 AS

  • May 20, 2011
  • 1 reply
  • 1098 views

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.

    This topic has been closed for replies.

    1 reply

    Participant
    May 28, 2011

    Now, no one is monitoring this?

    Adobe Employee
    May 31, 2011

    when creating the groupspec with GroupSpecifier, you don't enable multicast.  publishing to a group NetStream is considered multicast (whether P2P, IP, or fusion flavors).  you can't publish a stream to a group if multicast isn't enabled.  you need to specify GroupSpecifier.multicastEnabled=true.

    Participant
    June 1, 2011

    em, it appears I was wrong in believing peerToPeerDisabled=true sufficed for P2P publishing, while multicastEnabled was for IP multicast. I will try out the answer. Thanks for the help.