1

I want to stream live video from my android device using flash builder 4.6 mobile project...But couldn't achieve..help plz..

Here is my code:

  <?xml version="1.0" encoding="utf-8"?>
  <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
             xmlns:s="library://ns.adobe.com/flex/spark"
         creationComplete="windowedapplication1_creationCompleteHandler(event)"
             xmlns:mx="library://ns.adobe.com/flex/mx" width="480" height="800">
  <fx:Script>
    <![CDATA[
        import flash.filters.ColorMatrixFilter;
        import mx.events.FlexEvent;
        private var myCam:CameraUI;
        private var cam:Camera;
        private var nc:NetConnection;
        private var ns:NetStream;
        private var video:Video;
        private var meta:Object;
        private var nsClient:Object =new Object();
        protected function windowedapplication1_creationCompleteHandler(event:FlexEvent):void
        {
            connect();
        }
        private function connect():void
        {
            if(nc==null)
            {
                        nc = new NetConnection();
                nc.connect("rtmp://localhost/live");
                    // get status information from the NetConnection object
                nc.addEventListener(NetStatusEvent.NET_STATUS, netStatus);
                        }
        }
        private function netStatus(event:NetStatusEvent):void {
            var infoObject:Object=event.info;
            trace("nc: "+infoObject.code+" ("+infoObject.description+")");
            if (infoObject.code == "NetConnection.Connect.Success")
            {
                ns = new NetStream(nc);
                ns.publish("sample");
                ns.client = nsClient;
                video = new Video();
                video.smoothing = true;
                video.attachNetStream(ns);
                                    uic.addChild(video);
                }
        }
    ]]>
</fx:Script>
<fx:Declarations>
    <!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<mx:UIComponent id="uic" />
    </s:Application>

I couldn't stream video.i can't even see the video on my device itself..only blank page is open when i run this..

And I tried to find the error for that i replace

   ns.publish("sample") with ns.play("http://flv.dudeel.com/flv/p2DAM3FX7tBrk.flv")

Now I got the error at the line

  ns=new NetStream(nc);

  Error #2044: Unhandled NetStatusEvent:. level=error, code=NetStream.Play.StreamNotFound

What will be the solution and how to achieve in streaming video in this case?

Thanks,

divya
  • 81
  • 4
  • 13
  • There is no such stream available, that is what the error shows. Put break points in status event handler and see whats happening – Triode Apr 16 '12 at 10:38
  • Thanks @rajesh adhi, I tried using debugger..stream not found as you said.how to stream then? – divya Apr 16 '12 at 10:52
  • You need to get a valid stream means a valid stream should be there on your media server, or else you can a use sample video which is saved in your local machine and try to load that video using Netconnection. – Triode Apr 16 '12 at 10:54
  • http://www.adobe.com/devnet/flash/quickstart/metadata_cue_points.html Refer this link, this might be help full – Triode Apr 16 '12 at 11:00
  • But my problem is to stream a live video..I need not to play a video from my local machine.i just code ns.play("url") to find where the problem.When i tried to stream live video using ns.publish("streamname"); It shows nothing than a blank page..i want to capture video using netstream. – divya Apr 16 '12 at 11:04
  • are you sure you are connecting to the media server first. And also see these links or else you should share me the code. http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/NetStream.html http://help.adobe.com/en_US/flashmediaserver/devguide/WSd391de4d9c7bd609-52e437a812a3725dfa0-8000.html – Triode Apr 16 '12 at 11:10

1 Answers1

0

Maybe you need to implement the internet permission?

Batuhan
  • 100
  • 10