I am trying to build a app that will play videos on a Android tablet. The tablet is a transformer prime running a Android version 4.0.3. I am using flash Builder 4.6 with Flex 4.6.0. Every time i add a video to the tablet, it is very choppy and jumpy. If i try and use any video that is not flv then the video is always sent to the background behind all the other content and no longer stays with the container that it is placed into. I created a sliding containers that can be moved left or right and the video moves with them and it works with flv files but not with any other file formats (such as H.264 and f4v) it stays at the stage x = 0 and y = 0 not the group x = 0 and y = 0 and does not move. When ever a video is played there is always a screen flickers and then the video plays. Flv files are always the worst for playing back. Sorry I'm not trying to ramble I'm just trying to get the imported information
Here is the code for the video playing group that i created.
<?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"/>
So here is my question questions
Is there a better way to play this video so that it is smoother? I have heard about stage.stagevideo but if i trace stage.stagevideo.length i always get 0?
Why does the video lose the container. Could it have anything to do with having the container location set by using stage width?
Is there a way to buffer the video?