10 Replies Latest reply on Sep 19, 2011 2:07 PM by Daniel Pedrinha

    NetGroup.Connect.Rejected error driving me nuts

    Shane Stevens

      Hi,

       

      I am running into a problem whereby my app doesn't display the Flash P2P settings dialog.  The docs say:

       

      "In most cases, a groupspec has the potential for using the network uplink on the local system. When a NetStream or NetGroup object is constructed with a

      groupspec, Flash Player displays a Privacy Dialog."

       

      So when I create a NetGroup, I immediately get the "NetGroup.Connect.Rejected" error.  The problem is, it was working, and then it stopped.

       

      I discovered this post by Tom Krcha:

       

      http://www.flashrealtime.com/resolving-netgroupconnectrejected-or-when-your-flash-p2p-apps -stop-working/

       

      It didn't help, I'm always rejected.

       

      I'm using version teh Debug Flash runtime: Version 10.1.52.14 (10.1) on Mac.

       

      Anyway ideas?

       

      Cheers,

      Shane

        • 1. Re: NetGroup.Connect.Rejected error driving me nuts
          Michael Thornburgh Adobe Employee

          since you reference Tom's posting, i assume you've checked your settings to make sure you haven't accidentally remembered a "Deny" choice for the Peer Assisted Networking permission dialog.

           

          with that assumption, the most likely cause is you're trying to use the NetGroup after creating it but before the "NetGroup.Connect.Success" event is received by your code.  if you call any methods or access any properties on a NetGroup (or group NetStream) before the user has accepted the permission dialog, an exception will be raised and most likely also cause a NetGroup.Connect.Rejected event.

          • 2. Re: NetGroup.Connect.Rejected error driving me nuts
            Shane Stevens Level 1

            Hi Michael,

             

            Ok, so now I'm going out of my mind.

             

            1. I've made sure all of my global settings have been cleared, as per Tom's post.

            2. I then made sure I wasn't accessing the group before using it, no dice.

            3. For a sanity check I made a new test class which just creates a connection, then if successful, creates a NetGroup.

            4. Placed new tiny class in my app.  It fails!  I am completely shocked at this.

            5. Make a brand new AS3 project, and dump the same class into the new directory and call it.  It successfully connects! :|

            6. Make a brand new MXML application (which my actual app is), dump the class into the directory and call it.  It successfully connects again! :|

            7. As a sanity check, I now create a new MXML application inside my proper project, which looks identical to (6), call my class.  FAIL on group connect!

             

            In all the success cases, the Adobe settings dialog appears as expected.  In the fail cases, it doesn't appear, and I'm rejected.

             

            At this point the universe doesn't make any sense.  Both my main project and the fresh projects both set the Flex Compiler to use 10.1.0, and are otherwise the same, but clearly there must be some sort of difference.

             

            Now I'm going to backup my main project and keep stripping it back until there is nothing in it but the exact same files as (6).  If that doesn't work, I'll create a new project from scratch, and rebuild it back up until it fails.

             

            Just for completeness, here is my simple test class:

             

            package 
            {
                 import flash.events.NetStatusEvent;
                 import flash.net.GroupSpecifier;
                 import flash.net.NetConnection;
                 import flash.net.NetGroup;
            
                 public class CirrusTest
                 {
                      private static const kServer:String      ="rtmfp://p2p.rtmfp.net/";
                      private static const kDevKey:String      ="b39302209b667763e0ac0-blahblahblah-mykey";
                      private static const kGroupName:String     ="blah";
            
                      private var _nc:NetConnection;
                      private var _g:NetGroup;
            
                      public function CirrusTest()
                      {
                           // Connect
                           _nc = new NetConnection();
                           _nc.addEventListener(NetStatusEvent.NET_STATUS, netStatus, false, 0, true);
                           _nc.connect(kServer+kDevKey);
                      }
            
                      public function createGroup():void
                      {
                           var gs:GroupSpecifier=new GroupSpecifier(kGroupName);
                           gs.postingEnabled=true;
                           gs.serverChannelEnabled=true;
                           gs.routingEnabled=true;
            
                           var gsa:String=gs.groupspecWithAuthorizations();
            
                           _g=new NetGroup(_nc, gsa);
                           _g.addEventListener(NetStatusEvent.NET_STATUS, netStatus, false, 0, true);
                      }
            
                      public function netStatus(event:NetStatusEvent):void
                      {
                           trace(event.info.code);
            
                           switch(event.info.code)
                           {
                                case "NetConnection.Connect.Success":
                                     createGroup();
                                     break;
                                case "NetGroup.Connect.Rejected":
                                     trace("rejected groupid= " + event.info.group);
                                     break;
                                case "NetGroup.Connect.Success":
                                     trace("group created");
                                     break;
                           }
                      }
                 }
            }

            • 3. Re: NetGroup.Connect.Rejected error driving me nuts
              Shane Stevens Level 1

               

              Ok, after a great deal of pain involving manual file difference checking, I've tracked the issue down to a single line.

               

              The trouble is, it has absolutely nothing to do with the network API, and get this, it's not even in the swf source code... It's in the wrapper HTML!

               

              In my flash work, I try to enable "gpu" via the wmode parameter, which works fine.  However, this is the line which stops the P2P dialog from appearing.  If you check below, I've marked the offending line (params.wmode = "gpu";).  If I comment it in, I don't get a settings dialog, and if I comment it out, the dialog appears and successfully connects to the group.  This is just so bizarre, has anyone else see this?

               

              Here is a link to the tiny zipped project in my Dropbox, which shows the problem: http://db.tt/xiky91s I'd love to know what other people are getting.

               

               

              
              <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
              <!-- saved from url=(0014)about:internet -->
              <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
                  <!--
                  Smart developers always View Source.
              
                  This application was built using Adobe Flex, an open source framework
                  for building rich Internet applications that get delivered via the
                  Flash Player or to desktops via Adobe AIR.
              
                  Learn more about Flex at http://flex.org
                  // -->
                  <head>
                      <title>${title}</title>
                      <meta name="google" value="notranslate">
                      <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
                        <!-- Include CSS to eliminate any default margins/padding and set the height of the html element and
                             the body element to 100%, because Firefox, or any Gecko based browser, interprets percentage as
                              the percentage of the height of its parent container, which has to be set explicitly.  Fix for
                              Firefox 3.6 focus border issues.  Initially, don't display flashContent div so it won't show
                              if JavaScript disabled.
                        -->
                      <style type="text/css" media="screen">
                             html, body     { height:100%; }
                             body { margin:0; padding:0; overflow:auto; text-align:center;
                                    background-color: ${bgcolor}; }
                             object:focus { outline:none; }
                             #flashContent { display:none; }
                      </style>
              
                        <!-- Enable Browser History by replacing useBrowserHistory tokens with two hyphens -->
                      <!-- BEGIN Browser History required section ${useBrowserHistory}>
                      <link rel="stylesheet" type="text/css" href="history/history.css" />
                      <script type="text/javascript" src="history/history.js"></script>
                      <!${useBrowserHistory} END Browser History required section -->
              
                      <script type="text/javascript" src="swfobject.js"></script>
                      <script type="text/javascript">
                          <!-- For version detection, set to min. required Flash Player version, or 0 (or 0.0.0), for no version detection. -->
                          var swfVersionStr = "${version_major}.${version_minor}.${version_revision}";
                          <!-- To use express install, set to playerProductInstall.swf, otherwise the empty string. -->
                          var xiSwfUrlStr = "${expressInstallSwf}";
                          var flashvars = {};
                          var params = {};
                          params.quality = "high";
                          params.bgcolor = "${bgcolor}";
                          params.allowscriptaccess = "sameDomain";
                          params.allowfullscreen = "true";
              <!--            params.wmode = "gpu"; -->
                          var attributes = {};
                          attributes.id = "${application}";
                          attributes.name = "${application}";
                          attributes.align = "middle";
                          swfobject.embedSWF(
                              "${swf}.swf", "flashContent",
                              "${width}", "${height}",
                              swfVersionStr, xiSwfUrlStr,
                              flashvars, params, attributes);
                             <!-- JavaScript enabled so display the flashContent div in case it is not replaced with a swf object. -->
                             swfobject.createCSS("#flashContent", "display:block;text-align:left;");
                      </script>
                  </head>
                  <body>
                      <!-- SWFObject's dynamic embed method replaces this alternative HTML content with Flash content when enough
                              JavaScript and Flash plug-in support is available. The div is initially hidden so that it doesn't show
                              when JavaScript is disabled.
                        -->
                      <div id="flashContent">
                           <p>
                                To view this page ensure that Adobe Flash Player version
                                  ${version_major}.${version_minor}.${version_revision} or greater is installed.
                             </p>
                             <script type="text/javascript">
                                  var pageHost = ((document.location.protocol == "https:") ? "https://" :     "http://");
                                  document.write("<a href='http://www.adobe.com/go/getflashplayer'><img src='"
                                                      + pageHost + "www.adobe.com/images/shared/download_buttons/get_flash_player.gif' alt='Get Adobe Flash player' /></a>" );
                             </script>
                      </div>
              
                          <noscript>
                          <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="${width}" height="${height}" id="${application}">
                              <param name="movie" value="${swf}.swf" />
                              <param name="quality" value="high" />
                              <param name="bgcolor" value="${bgcolor}" />
                              <param name="allowScriptAccess" value="sameDomain" />
                              <param name="allowFullScreen" value="true" />
                              <!--[if !IE]>-->
                              <object type="application/x-shockwave-flash" data="${swf}.swf" width="${width}" height="${height}">
                                  <param name="quality" value="high" />
                                  <param name="bgcolor" value="${bgcolor}" />
                                  <param name="allowScriptAccess" value="sameDomain" />
                                  <param name="allowFullScreen" value="true" />
                              <!--<![endif]-->
                              <!--[if gte IE 6]>-->
                                   <p>
                                        Either scripts and active content are not permitted to run or Adobe Flash Player version
                                        ${version_major}.${version_minor}.${version_revision} or greater is not installed.
                                   </p>
                              <!--<![endif]-->
                                  <a href="http://www.adobe.com/go/getflashplayer">
                                      <img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash Player" />
                                  </a>
                              <!--[if !IE]>-->
                              </object>
                              <!--<![endif]-->
                          </object>
                       </noscript>
                 </body>
              </html>
              
              

               

               

              • 4. Re: NetGroup.Connect.Rejected error driving me nuts
                Michael Thornburgh Adobe Employee

                interesting.  i'll ask our QE department to look into this.

                • 5. Re: NetGroup.Connect.Rejected error driving me nuts
                  Shane Stevens Level 1

                  Hi Michael,

                   

                  Thanks for sending on to QA.

                   

                  In the meantime, I've tried all sorts of bizarre ways to make the html cause a failure, and in the end, rather than type out all of the permutations, I'll tell you a dead simple way to fail every time.

                   

                  Use the official SWFObject 2 generator below, and do nothing except set the width and height to 100 percent, and it will fail; no wmode or anything.

                   

                  http://www.bobbyvandersluis.com/swfobject/generator/index.html

                   

                  This is the simplest html I could create which fails.

                   

                  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
                  <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
                       <head>
                            <title></title>
                            <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
                            <script type="text/javascript" src="swfobject.js"></script>
                            <script type="text/javascript">
                                 swfobject.registerObject("myFlashContent", "10.1.0");
                            </script>
                       </head>
                       <body>
                            <div>
                                 <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="100%" height="100%" id="myFlashContent">
                                      <param name="movie" value="untitled.swf" />
                                      <!--[if !IE]>-->
                                      <object type="application/x-shockwave-flash" data="untitled.swf" width="100%" height="100%">
                                      <!--<![endif]-->
                                           
                                      <!--[if !IE]>-->
                                      </object>
                                      <!--<![endif]-->
                                 </object>
                            </div>
                       </body>
                  </html>
                  

                   

                  At this point it's a complete mystery to me.  How can visual parameters affect NetGroup connections!?  It's biazrre.

                   

                  Cheers,

                  Shane

                  • 6. Re: NetGroup.Connect.Rejected error driving me nuts
                    Michael Thornburgh Adobe Employee

                    Flash Player's drawing region must be large enough to present the permission/settings dialog (with a reasonable border).  i don't know what the exact minimum dimensions are, but it can't be clipped or obscured.  this is a feature.

                     

                    if percentages aren't allowed for the "width" and "height" attributes of those tags (i don't know offhand), they'll be interpreted as pixel dimensions, and 100x100 pixels isn't big enough to present the dialog box.

                    • 7. Re: NetGroup.Connect.Rejected error driving me nuts
                      Shane Stevens Level 1

                      I'm aware of this requirement, however the the Adobe docs say that percentages are allowed in the <object> and <embed> tags:

                       

                      http://kb2.adobe.com/cps/127/tn_12701.html

                       

                      Required attributes

                       

                      The following attributes are required within the object and/or embed tags when adding a Flash movie to an HTML page:

                       

                      "Both object and embed:

                      width - Specifies the width of the movie in either pixels or percentage of browser window.

                      height - Specifies the height of the movie in either pixels or percentage of browser window."

                       

                      • 8. Re: NetGroup.Connect.Rejected error driving me nuts
                        Daniel Pedrinha Level 1

                        Hi. Thank God I found this topic, I was having the same problem and thanks to you I found out that the problem was that I was using wmode="direct".

                         

                        It's surely something Adobe should take a look, we need those modes.

                        • 9. Re: NetGroup.Connect.Rejected error driving me nuts
                          Michael Thornburgh Adobe Employee

                          the "Peer Assisted Networking" dialog not showing up when wmode=direct is a known bug that is already corrected internally. it will be fixed in a future release of Flash Player. i don't think i'm allowed to say "it is fixed in Future Flash Player Version X"; however, i think if you check out the Flash Player 11 beta, the problem should be fixed there. 

                           

                          note that this problem also affects the camera/microphone permission dialog and the settings panel.

                          • 10. Re: NetGroup.Connect.Rejected error driving me nuts
                            Daniel Pedrinha Level 1

                            Okay good to know thank you for the update