I have a custom FLVPLayback class that isn’t progressively downloading - it’s downloading the entire video into the browser cache before the FLVPlayback gets added to the display list. I’m really stumped. Anyone know what’s up?
The code:
package com.video{
import flash.events.Event;
import flash.events.MouseEvent;
import flash.events.NetStatusEvent;
import flash.events.ProgressEvent;
import flash.events.SecurityErrorEvent;
import flash.display.Sprite;
import fl.video.FLVPlayback;
import fl.video.*;
public class FLVVideoPlayer extends Sprite {
public static const LOADED:String = "loaded";
private var video:FLVPlayback = new FLVPlayback();;
private var videoURL:String = "";
private var mc:Loading_mc = new Loading_mc;
public function FLVVideoPlayer(url:String):void {
videoURL = url;
addChild(video);
video.load(videoURL);
video.addEventListener(VideoEvent.READY, videoReadyHandler);
video.width = 800;
video.height = 480;
mc.x = 500;
mc.y = 200;
addChild(mc);
video.addEventListener(ProgressEvent.PROGRESS, preLoaderDisplay);
video.skin = "videos/SkinOverPlayStopSeekFullVol.swf";
video.skinAutoHide = true;
video.skinBackgroundAlpha = .8;
}
public function play():void {
video.playWhenEnoughDownloaded ()
}
public function pause():void {
video.pause();
}
private function preLoaderDisplay(e:ProgressEvent):void
{
var perc:Number = e.bytesLoaded / e.bytesTotal;
mc.percent_txt.text = Math.ceil(perc * 100).toString() + "%";
mc.scaleX *= 1.01;
mc.scaleY *= 1.01;
}
private function videoReadyHandler(e:Event):void {
dispatchEvent(new Event(PreloadingVideoPlayer.LOADED));
removeChild(mc);
}
}
}