Buffer bar doesnt show up until video is completly loaded

Ok, so I have tried and tried to figure this out. Of course in the test environment everything works beautifully, but when I test my swf on my site, thats when the sh*t hits the fan.

The problem is my buffer bar wont show up until the video is completly loaded. In flash however, it loads across as the video is downloaded, like it’s supposed to.

Go to my site to see what I am talking about. The loader bar appears uder the progress bar, exactly like on youtube. www.blankensteincreations.com

Here is the code that controls it.

mcVideoControls.mcProgressFill.mcFillGrey.width = nsStream.bytesLoaded * 710 / nsStream.bytesTotal;

Of course that is wrapped in a timer funtion which, I add, works fine.

FLA is attatched as well as the code below so you can see how it works in flash.

Here is my full code:


const BUFFER_TIME:Number    = 8;
const DEFAULT_VOLUME:Number    = 0.6;
const DISPLAY_TIMER_UPDATE_DELAY:int = 10;
const SMOOTHING:Boolean     = true;
 
var bolLoaded:Boolean     = false;
var bolVolumeScrub:Boolean    = false;
var bolProgressScrub:Boolean   = false;
var intLastVolume:Number    = DEFAULT_VOLUME;
var ncConnection:NetConnection;
var nsStream:NetStream;
var objInfo:Object;
 
var flvSource:String;
var paramObj:Object = LoaderInfo(this.root.loaderInfo).parameters;
flvSource = paramObj.flvSource;
 
 
var strSource:String     = flvSource;
 
if(flvSource == null){
 
 trace("Stream not Defined. Using Test Stream");
 strSource = "http://www.blankensteincreations.com/videos/heartbeats.flv";
 
}
var tmrDisplay:Timer;
function initVideoPlayer():void {
 mcVideoControls.btnUnmute.visible = false;
 mcVideoControls.btnPause.visible = false;
 
 
 
 
 mcVideoControls.mcProgressFill.mcFillRed.width = 1;
 mcVideoControls.mcProgressFill.mcFillGrey.width = 1;
 
 stage.addEventListener( MouseEvent.MOUSE_UP, mouseReleased);
 
 pause_btn.addEventListener(MouseEvent.CLICK, pause_btnClicked);
 play_btn.addEventListener(MouseEvent.CLICK, play_btnClicked);
 mcVideoControls.btnPause.addEventListener(MouseEvent.CLICK, pauseClicked);
 mcVideoControls.btnPlay.addEventListener(MouseEvent.CLICK, playClicked);
 mcVideoControls.btnStop.addEventListener(MouseEvent.CLICK, stopClicked);
 mcVideoControls.btnMute.addEventListener(MouseEvent.CLICK, muteClicked);
 mcVideoControls.btnUnmute.addEventListener(MouseEvent.CLICK, unmuteClicked);
 mcVideoControls.mcVolumeScrubber.addEventListener(MouseEvent.MOUSE_DOWN, volumeScrubberClicked);
 mcVideoControls.mcProgressScrubber.btnProgressScrubber.addEventListener(MouseEvent.MOUSE_DOWN, progressScrubberClicked);
 
 tmrDisplay = new Timer(DISPLAY_TIMER_UPDATE_DELAY);
 tmrDisplay.addEventListener(TimerEvent.TIMER, updateDisplay);
 
 ncConnection = new NetConnection();
 ncConnection.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
 ncConnection.connect(null);
 
 nsStream = new NetStream(ncConnection);
 nsStream.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
 nsStream.client = this;
 nsStream.bufferTime = BUFFER_TIME;
 
 vidDisplay.attachNetStream(nsStream);
 vidDisplay.smoothing = SMOOTHING;
 mcVideoControls.mcVolumeScrubber.x = (52 * DEFAULT_VOLUME) + 611;
 mcVideoControls.mcVolumeFill.mcFillRed.width = mcVideoControls.mcVolumeScrubber.x - 664 + 52;
 setVolume(DEFAULT_VOLUME);
 
 /*if(!bolLoaded) {
nsStream.play(strSource);
bolLoaded = true;
nsStream.pause();
play_btn.visible = true;
 
}*/
 
}
 
function play_btnClicked(e:MouseEvent):void {
 playClicked(null);
}
function pause_btnClicked(e:MouseEvent):void {
 pauseClicked(null);
}
 
 
function playClicked(e:MouseEvent):void {
 if(!bolLoaded) {
  nsStream.play(strSource);
  bolLoaded = true;
  play_btn.visible = true;
 }
 else{
  nsStream.resume();
  play_btn.visible = false;
  pause_btn.visible = true;
 }
 
 vidDisplay.visible     = true;
 
 mcVideoControls.btnPause.visible = true;
 mcVideoControls.btnPlay.visible  = false;
}
function pauseClicked(e:MouseEvent):void {
 nsStream.pause();
 play_btn.visible = true;
 pause_btn.visible = false;
 
 mcVideoControls.btnPause.visible = false;
 mcVideoControls.btnPlay.visible  = true;
}
function stopClicked(e:MouseEvent):void {
 stopVideoPlayer();
}
function muteClicked(e:MouseEvent):void {
 setVolume(0);
 
 mcVideoControls.mcVolumeScrubber.x    = 611;
 mcVideoControls.mcVolumeFill.mcFillRed.width = 1;
}
function unmuteClicked(e:MouseEvent):void {
 setVolume(intLastVolume);
 mcVideoControls.mcVolumeScrubber.x = (53 * intLastVolume) + 611;
 mcVideoControls.mcVolumeFill.mcFillRed.width = mcVideoControls.mcVolumeScrubber.x - 664 + 53;
}
function volumeScrubberClicked(e:MouseEvent):void {
 bolVolumeScrub = true;
 
 mcVideoControls.mcVolumeScrubber.startDrag(false, new Rectangle(611, 21, 53, 0));
}
function progressScrubberClicked(e:MouseEvent):void {
 bolProgressScrub = true;
 
 mcVideoControls.mcProgressScrubber.startDrag(false, new Rectangle(0, 8, 701, 0));
}
function mouseReleased(e:MouseEvent):void {
 bolVolumeScrub  = false;
 bolProgressScrub = false;
 
 mcVideoControls.mcProgressScrubber.stopDrag();
 mcVideoControls.mcVolumeScrubber.stopDrag();
 
 mcVideoControls.mcProgressFill.mcFillRed.width = mcVideoControls.mcProgressScrubber.x + 5;
 mcVideoControls.mcVolumeFill.mcFillRed.width = mcVideoControls.mcVolumeScrubber.x - 664 + 53;
 
 if((mcVideoControls.mcVolumeScrubber.x - 611) / 53 > 0)
  intLastVolume = (mcVideoControls.mcVolumeScrubber.x - 611) / 53;
}
function updateDisplay(e:TimerEvent):void {
 
 
 if(bolProgressScrub)
  nsStream.seek(mcVideoControls.mcProgressScrubber.x * objInfo.duration / 710)
 else
  mcVideoControls.mcProgressScrubber.x = nsStream.time * 710 / objInfo.duration; 
 
 mcVideoControls.lblTimeDuration.htmlText  = "<font color='#ffffff'>" + formatTime(nsStream.time) + "</font> / " + formatTime(objInfo.duration);
 
 mcVideoControls.mcProgressFill.mcFillRed.width = mcVideoControls.mcProgressScrubber.x;
 mcVideoControls.mcProgressFill.mcFillGrey.width = nsStream.bytesLoaded * 710 / nsStream.bytesTotal;
 
 if(bolVolumeScrub) {
  setVolume((mcVideoControls.mcVolumeScrubber.x - 611) / 53);
  mcVideoControls.mcVolumeFill.mcFillRed.width = mcVideoControls.mcVolumeScrubber.x - 664 + 53;
 }
}
function onMetaData(info:Object):void {
 objInfo = info;
 
 tmrDisplay.start();
}
function netStatusHandler(event:NetStatusEvent):void {
 switch (event.info.code) {
  case "NetStream.Play.StreamNotFound":
   trace("Stream not found: " + strSource);
  break;
 
  case "NetStream.Play.Stop":
   stopVideoPlayer();
  break;
 }
}
function stopVideoPlayer():void {
 nsStream.pause();
 nsStream.seek(0);
 play_btn.visible = true;
 pause_btn.visible = false;
 vidDisplay.visible     = false;
 
 mcVideoControls.btnPause.visible = false;
 mcVideoControls.btnPlay.visible  = true;
}
function setVolume(intVolume:Number = 0):void {
 var sndTransform  = new SoundTransform(intVolume);
 nsStream.soundTransform = sndTransform;
 
 if(intVolume > 0) {
  mcVideoControls.btnMute.visible  = true;
  mcVideoControls.btnUnmute.visible = false;
 } else {
  mcVideoControls.btnMute.visible  = false;
  mcVideoControls.btnUnmute.visible = true;
 }
}
function formatTime(t:int):String {
 var s:int = Math.round(t);
 var m:int = 0;
 if (s > 0) {
  while (s > 59) {
   m++;
   s -= 60;
  }
  return String((m < 10 ? "0" : "") + m + ":" + (s < 10 ? "0" : "") + s);
 } else {
  return "00:00";
 }
}
 
initVideoPlayer();
if(!bolLoaded) {
nsStream.play(strSource);
bolLoaded = true;
nsStream.pause();
play_btn.visible = true;
 
}
 
var my_menu:ContextMenu = new ContextMenu();
my_menu.hideBuiltInItems();
var copyright = new ContextMenuItem("Copyright © " + new Date().getFullYear() + " Blankenstein Creations");
function openLink(e:ContextMenuEvent):void{
navigateToURL(new URLRequest("http://www.blankensteincreations.com"));
}
copyright.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, openLink);
my_menu.customItems.push(copyright);
contextMenu = my_menu;
 
stage.addEventListener(MouseEvent.MOUSE_MOVE, onmouseMove);
function onmouseMove(event:MouseEvent) {
 
 mcVideoControls.visible = true;
 
 
 if (currentFrame <= 2)
 {
  gotoAndPlay(3);
 }
 if (currentFrame >= 16 && currentFrame <= 46)
 {
  gotoAndPlay(16);
 
 }
};