I have a set of Flash Video Actors on transparent backgrounds. That I need to load quickly.
When they first load, the audio is choppy. If I hit refresh the video plays correctly.
I started using the below code initially, which loads the video fast, but the audio is choppy.
var nc:NetConnection = new NetConnection();
nc.connect(null);
var ns:NetStream = new NetStream(nc);
videoPlayer.attachVideo(ns);
videoPlayer._width = 334;
videoPlayer._height = 480;
ns.play("VIDEO FILE");
So, I switched over to the below code and played with the load percentage, thinking that if I start playing video at 30% the rest would load better. But, the first 30% loads great then the rest is choppy. I don’t have the ability to do the streaming via like RMTP.
stop();
var paramList:Object = this.root.loaderInfo.parameters;
var video:Video = new Video(334, 480);
addChild(video);
video.x = 0;
video.y = 0;
var nc:NetConnection = new NetConnection();
nc.connect(null);
var ns:NetStream = new NetStream(nc);
ns.addEventListener(NetStatusEvent.NET_STATUS, onStatusEvent);
function onStatusEvent(event:NetStatusEvent):void
{
switch (event.info.code)
{
case "NetStream.Play.Stop":
trace("The Video has stopped");
removeChild(video);
break;
}
}
var meta:Object = new Object();
meta.onMetaData = function(meta:Object);
{
trace(meta.duration);
}
ns.client = meta;
video.attachNetStream(ns);
ns.play("video_file");
ns.pause();
var checker:Timer = new Timer(100,0);
checker.addEventListener(TimerEvent.TIMER, preLoader);
checker.start();
function preLoader (event:Event):void
{
trace(ns.bytesLoaded, ns.bytesTotal);
var bytestotal = ns.bytesTotal;
var bytesloaded = ns.bytesLoaded;
var load_percent, cur_percent;
load_percent = 20;
cur_percent = (bytesloaded / bytestotal) * 100;
if (cur_percent >= load_percent) {
checker.stop();
checker.removeEventListener(TimerEvent.TIMER, preLoader);
checker = null;
ns.resume();
}
}
I also tried the Super Video converter from (http://www.erightsoft.com) to lower the size of the FLV. Which worked great, however the transparent background was removed.
Any help would be appreciated.