Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Multicast video share

Guest
Sep 22, 2013 Sep 22, 2013

I am trying to built a multicast sample of video broadcast. with the trial version of AMS on my local system.

package {

    import flash.display.MovieClip;

    import flash.net.NetConnection;

    import flash.events.NetStatusEvent;

    import flash.net.NetStream;

    import flash.media.Video;

    import flash.media.Camera;

    import flash.media.Microphone;

    import flash.net.NetStreamPlayOptions;

    import flash.net.NetStreamPlayTransitions;

    import flash.net.GroupSpecifier;

    import flash.net.NetGroup;

    public class multicast extends MovieClip

    {

        var nc:NetConnection;

        var ns:NetStream;

        var vid:Video;

        var vidPlayer:Video;

        private var group:NetGroup;

        public var devkey:String = "e4a84a9a6d0d3ce822fa4610-f148941b683a";

        public function multicast()

        {

            nc = new NetConnection();

            nc.addEventListener(NetStatusEvent.NET_STATUS, onNetStatus);

            nc.connect("rtmfp://192.168.1.167/multicast");

            nc.client = {onBWDone:function():void{}};

        }

        private function onNetStatus(event:NetStatusEvent):void{

            switch(event.info.code)

            {

                case "NetConnection.Connect.Success":

                    setupGroup();

                    break;

                case "NetGroup.Connect.Success":

                    trace("Group has been generated");

                    break;

                case "NetGroup.Posting.Notify":

                    break;

            }

        }

        private function setupGroup():void

        {

            var groupspec:GroupSpecifier = new GroupSpecifier("myGroup");

            groupspec.postingEnabled = true;

            groupspec.ipMulticastMemberUpdatesEnabled = true;

            groupspec.addIPMulticastAddress("192.168.1.167:30000");

            ns = new NetStream(nc, groupspec.groupspecWithAuthorizations());   

            ns.addEventListener(NetStatusEvent.NET_STATUS, onNetStatus);

            var cami:Camera = Camera.getCamera();

            ns.attachCamera(cami);

            ns.publish("multicast");

           

            vid = new Video(cami.width, cami.height);

            vid.x = 0;

            vid.y = 0;

            vid.attachCamera(cami);

            addChild(vid);

        }

    }

}

Following is the error I am facing:

Error: Error #2154: The NetStream Object is invalid.  This may be due to a failed NetConnection.

    at flash.net::NetStream/invoke()

    at flash.net::NetStream/attachCamera()

    at multicast/setupGroup()

    at multicast/onNetStatus()

Is there some problem with the server url. Please suggest.

TOPICS
ActionScript
979
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 23, 2013 Sep 23, 2013

You're not setting any NetConnection event listeners for potential connection issues. The error is just letting you know the NetConnection failed. Be sure any firewalls on the LAN server you're connecting to have rules to allow the connection as well.

As a symantics thing you should always add scope parameters to all class member variables (e.g. var nc:NetConnection; should be public/private/protected nc:NetConnection).

Lastly you should verify the camera is validly connected, just check if (cami != null)

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Sep 30, 2013 Sep 30, 2013

Done with all the changes. No error is showing now but the streaming is also not working.

I am using flash player 11.2

AMS     5.1 multicast sample on the server side.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 30, 2013 Sep 30, 2013

In contrast to errors, are there any positive traces? Like connection success, etc? Where the does the trail of success finally end? That's where you're going to need to investigate.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Oct 14, 2013 Oct 14, 2013
LATEST

No, There is no any success or error message displayed.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines