如何使用AdobeAIR mobile在android平板电脑上播放视频,而不让视频起伏?

如何使用AdobeAIR mobile在android平板电脑上播放视频,而不让视频起伏?,android,apache-flex,mobile,air,flash-builder,Android,Apache Flex,Mobile,Air,Flash Builder,我正在尝试构建一个可以在Android平板电脑上播放视频的应用程序。这款平板电脑是运行安卓4.0.3版的transformer prime。我正在使用flash Builder 4.6和Flex 4.6.0。每次我在平板电脑上添加视频时,它都会变得非常起伏和跳跃。如果我尝试使用任何不是flv的视频,那么视频总是被发送到所有其他内容后面的背景中,并且不再停留在它所放入的容器中。我创建了一个滑动容器,可以向左或向右移动,视频也可以随之移动,它可以处理flv文件,但不能处理任何其他文件格式(如H.26

我正在尝试构建一个可以在Android平板电脑上播放视频的应用程序。这款平板电脑是运行安卓4.0.3版的transformer prime。我正在使用flash Builder 4.6和Flex 4.6.0。每次我在平板电脑上添加视频时,它都会变得非常起伏和跳跃。如果我尝试使用任何不是flv的视频,那么视频总是被发送到所有其他内容后面的背景中,并且不再停留在它所放入的容器中。我创建了一个滑动容器,可以向左或向右移动,视频也可以随之移动,它可以处理flv文件,但不能处理任何其他文件格式(如H.264和f4v)。它停留在阶段x=0和y=0,而不是组x=0和y=0,并且不移动。每当播放视频时,屏幕总是闪烁,然后视频播放。Flv文件总是最不适合播放。对不起,我不是想漫无边际,我只是想获取导入的信息
以下是我创建的视频播放组的代码。

<?xml version="1.0" encoding="utf-8"?>
<s:Group xmlns:fx="http://ns.adobe.com/mxml/2009" 
     xmlns:s="library://ns.adobe.com/flex/spark" width="960" height="533" xmlns:mx="library://ns.adobe.com/flex/mx">
<fx:Script>
    <![CDATA[
        import mx.events.EffectEvent;
        [Bindable] public var imgSource:String = new String(); 
        [Bindable] public var isThereAVideo:Boolean = new Boolean()
        public var movieSource:String = new String();
        [Bindable] protected var bytes:uint = new uint();
        [Bindable] protected var bytesTotel:uint = new uint();

        protected function playMovieClick(event:MouseEvent):void
        {
            // TODO Auto-generated method stub
            trace ("you clicked")
            var nc:NetConnection = new NetConnection();
            nc.connect(null);
            var ns:NetStream = new NetStream(nc);
            ns.addEventListener(AsyncErrorEvent.ASYNC_ERROR, asyncErrorHandler);
            ns.client={ onMetaData:function(obj:Object):void{} }
            ns.play(movieSource);
            var myVideo:Video = new Video();
            myVideo.width = 960;
            myVideo.height = 533;
            myVideo.attachNetStream(ns);
            uic.addChild(myVideo);
            ns.addEventListener(NetStatusEvent.NET_STATUS, netstatusHandler);
            quickfade.target = uic;
            quickfade.alphaFrom = 0;
            quickfade.alphaTo = 1;
            quickfade.play();
            ns.soundTransform.volume = 0;


        }


        public function netstatusHandler(evt:NetStatusEvent):void {
            if (evt.info.code == "NetStream.Play.Stop") {
                quickfade.target = uic;
                quickfade.alphaTo = 0;
                quickfade.alphaFrom = 1;
                quickfade.play();
                quickfade.addEventListener(EffectEvent.EFFECT_END, fadeEffectEnd);
            }
        }

        private function fadeEffectEnd(event:EffectEvent):void {
            trace("effect ending");
            uic.visible = false;
            trace("....effect ending");
            quickfade.removeEventListener(EffectEvent.EFFECT_END, fadeEffectEnd);
        }

        public function asyncErrorHandler(event:AsyncErrorEvent):void {
            trace(event.text);
        }
    ]]>
</fx:Script>
<fx:Declarations>
    <!-- Place non-visual elements (e.g., services, value objects) here -->
    <s:Fade id="quickfade" duration="1500" />
</fx:Declarations>
<s:Image width="100%" height="100%" source="{imgSource}"/>
<s:Image width="75" height="75" bottom="5" right="5" source="img/videoIcon.png" click="playMovieClick(event)" visible="{isThereAVideo}" />
<mx:UIComponent x="0" y="0" id="uic" width="960" height="533" alpha="0" />
<s:Label x="10" y="508" text="v0.1"/>

下面是我的问题
是否有更好的方式播放此视频,使其更流畅?我听说过stage.stagevideo,但是如果我追踪stage.stagevideo.length,我总是得到0
为什么视频会丢失容器。这是否与使用“舞台宽度”设置容器位置有关

有没有办法缓冲视频?

播放视频的最佳方法是使用本机播放器而不是flex视频播放器。您仍然需要在flex中播放,然后您可以尝试Stage Video(),因为移动设备上的flex会跳过视频帧。

为什么不使用Flash Builder的视频组件?它有一些高级功能,可以让你分配更多。当我使用VideoDisplay或videoPlayer时,它会说“Adobe不鼓励在定位配置文件时使用VideoDisplay:mobileDevice”。因此,我在定位移动平台时没有使用它。我应该不用担心吗?你知道为什么视频启动时屏幕会闪烁吗?
<?xml version="1.0" encoding="utf-8"?>
<s:Group xmlns:fx="http://ns.adobe.com/mxml/2009" 
     xmlns:s="library://ns.adobe.com/flex/spark" width="960" height="533" xmlns:mx="library://ns.adobe.com/flex/mx">
<fx:Script>
    <![CDATA[
        import mx.events.EffectEvent;
        [Bindable] public var imgSource:String = new String(); 
        [Bindable] public var isThereAVideo:Boolean = new Boolean()
        public var movieSource:String = new String();
        [Bindable] protected var bytes:uint = new uint();
        [Bindable] protected var bytesTotel:uint = new uint();

        protected function playMovieClick(event:MouseEvent):void
        {
            // TODO Auto-generated method stub
            trace ("you clicked")
            var nc:NetConnection = new NetConnection();
            nc.connect(null);
            var ns:NetStream = new NetStream(nc);
            ns.addEventListener(AsyncErrorEvent.ASYNC_ERROR, asyncErrorHandler);
            ns.client={ onMetaData:function(obj:Object):void{} }
            ns.play(movieSource);
            var myVideo:Video = new Video();
            myVideo.width = 960;
            myVideo.height = 533;
            myVideo.attachNetStream(ns);
            uic.addChild(myVideo);
            ns.addEventListener(NetStatusEvent.NET_STATUS, netstatusHandler);
            quickfade.target = uic;
            quickfade.alphaFrom = 0;
            quickfade.alphaTo = 1;
            quickfade.play();
            ns.soundTransform.volume = 0;


        }


        public function netstatusHandler(evt:NetStatusEvent):void {
            if (evt.info.code == "NetStream.Play.Stop") {
                quickfade.target = uic;
                quickfade.alphaTo = 0;
                quickfade.alphaFrom = 1;
                quickfade.play();
                quickfade.addEventListener(EffectEvent.EFFECT_END, fadeEffectEnd);
            }
        }

        private function fadeEffectEnd(event:EffectEvent):void {
            trace("effect ending");
            uic.visible = false;
            trace("....effect ending");
            quickfade.removeEventListener(EffectEvent.EFFECT_END, fadeEffectEnd);
        }

        public function asyncErrorHandler(event:AsyncErrorEvent):void {
            trace(event.text);
        }
    ]]>
</fx:Script>
<fx:Declarations>
    <!-- Place non-visual elements (e.g., services, value objects) here -->
    <s:Fade id="quickfade" duration="1500" />
</fx:Declarations>
<s:Image width="100%" height="100%" source="{imgSource}"/>
<s:Image width="75" height="75" bottom="5" right="5" source="img/videoIcon.png" click="playMovieClick(event)" visible="{isThereAVideo}" />
<mx:UIComponent x="0" y="0" id="uic" width="960" height="533" alpha="0" />
<s:Label x="10" y="508" text="v0.1"/>