Well i have Custom Slider for FLV videos and here is the code for it. Assuming variables are pre-defined
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
public function FLV_PLAYER3():void
{
nc.connect(null);
ns = new NetStream(nc);
MainContainer.AddVideo.addChild(vid);
vid.attachNetStream(ns);
ns.client = {onMetaData:GetDuration, NetStatusEvent:ns_onPlayStatus};
ns.addEventListener(NetStatusEvent.NET_STATUS, ns_onPlayStatus);
ns.play("3.flv");
}
public function ns_onPlayStatus(event:NetStatusEvent):void
{
if (event.info.code == "NetStream.Play.Stop")
{
trace(" Stop EnterFrameEvent at " + EnterFrameCounter)
this.removeEventListener(Event.ENTER_FRAME,PerFrameScript)
}
}
public function PerFrameScript(evt:Event)
{
EnterFrameCounter++;
progressBar_mc.pgbar.width += PerFrameIncrement
}
public function GetDuration(meta:Object):void {
duration = meta.duration;
duration = (AdditionalTime+duration);
Divider = (progressBar_mc.whitebar.width)/duration;
progressBar_mc.pgbar.x = (progressBar_mc.whitebar.x-5);
progressBar_mc.pgbar.y = (progressBar_mc.whitebar.y);
PerFrameIncrement = Number(Divider/stage.frameRate);
trace("Increment Per Second is "+Divider);
trace("PerFrameIncrement is "+PerFrameIncrement);
trace("progressBar_mc.whitebar.width is "+progressBar_mc.whitebar.width);
this.addEventListener(Event.ENTER_FRAME,PerFrameScript)
}
Now progressBar_mc.pgbar shows the progress of the FLV and it should stop when reaching to progressBar_mc.whitebar.width as required. But sometimes it goes ahead, sometimes it stops before reaching to the end i.e progressBar_mc.whitebar.width. The slider has other problems too , by changing the swf frame-rate it goes ahead or stops before. I can not use FLv time() function to customerize the slider as i am adding an extra time i.e duration = (AdditionalTime+duration);
My goal is to make the slider moving even when stream/FLV is paused by an event. If the FLV/stream is paused by user , the slider will surely stop. Now the below links will help u understand what is required.
http://web.s4spk.com/irfan/flvtest/player.swf
http://web.s4spk.com/irfan/flvtest/CuePoints2.xml
FLV Stream pause event is fired when any circle is drawn on FLV and the timing of the circle to be visible or hide is extracted from XML. You can download the swf and XML and take any FLV but rename FLV to 3.flv.The slider gets stopped when Pause-Event is fired and i want it keep moving. If the above code is corrected then i will merge that into this player and that's why i can not use FLV time() function to customize the slider, hence Additional time is added to it.