I want to create an ipad application with several videos. All videos must be embedded within flash, so no streaming. I can embed flv on timeline on play it that way, but is there some other way how I can control playback with Actionscript referencing video object that is in library or maybe using embed tags in AS - that way I would be able to gain more control and access cuepoints too.
You have to embed file and append NetStream bytes :
[Embed(source = "movie.flv", mimeType = "application/octet-stream")]
public var bytes:Class;
public var video:Video = new Video(640, 480);
public function Main():void {
addChild(video);
var nc:NetConnection = new NetConnection();
nc.addEventListener(NetStatusEvent.NET_STATUS , onConnect);
nc.addEventListener(AsyncErrorEvent.ASYNC_ERROR , trace);
var metaSniffer:Object=new Object();
nc.client=metaSniffer;
metaSniffer.onMetaData=getMeta;
nc.connect(null);
}
private function getMeta (mdata:Object):void {
video.width=mdata.width/2;
video.height=mdata.height/2;
};
private function onConnect(e:NetStatusEvent):void {
if (e.info.code == 'NetConnection.Connect.Success') {
trace(e.target as NetConnection);
var ns:NetStream = new NetStream(e.target as NetConnection);
ns.client = {};
var file:ByteArray = new bytes();
ns.play(null);
ns.appendBytes(file);
video.attachNetStream(ns);
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With