# Preload FLV (Live Actor type videos)

**URL:** <https://forum.kirupa.com/t/preload-flv-live-actor-type-videos/322572>\
**Category:** flash\
**Created:** [May 25, 2011, 7:21pm UTC](https://forum.kirupa.com/t/preload-flv-live-actor-type-videos/322572 "2011-05-25T19:21:28Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![imvain2](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/imvain2/32/620_2.png) [@imvain2](https://forum.kirupa.com/u/imvain2)\
**Post date:** [May 25, 2011, 7:21pm UTC](https://forum.kirupa.com/t/preload-flv-live-actor-type-videos/322572/1 "2011-05-25T19:21:28Z")

</div>

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.

```auto

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.

```auto

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](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.
