如何使用flex 4.6移动项目在Air android上播放视频?

时间:2012-04-16 10:32:25

标签: android flex air

我想使用Flash Builder 4.6移动项目从我的Android设备中直播视频...但无法实现..帮助PLZ ..

这是我的代码:

  <?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>

我无法播放视频。我甚至无法在设备上看到视频。当我运行时,只有空白页面才会打开..

我试图找到替换

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

现在我收到了

行的错误
  ns=new NetStream(nc);

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

在这种情况下,解决方案是什么以及如何在流视频中实现?

谢谢,

1 个答案:

答案 0 :(得分:0)

也许您需要实施互联网许可?