I have got a basic video player setup. I am trying to figure out a way to do
live scrubbing so basically when the user drags the slider the video is
updated also , but since it updates it so often
it starts lagging, especially its more evident when the flv is really big
and also exactly when does mousDownOutsite event get called ??

Thanks
cheers
firdosh

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"; layout="vertical">
   <mx:Script>
       <![CDATA[
           import mx.events.VideoEvent;

           private function onVideoStateChangeHandler(evt:VideoEvent):void{
               trace(evt.state);
           }

           private function playVideo(evt:MouseEvent):void{
               videoScreen.play();
           }

           private function stopVideo(evt:MouseEvent):void{
               videoScreen.stop();
           }



           private function updateSlider(evt:VideoEvent):void{
               if(videoScreen.state==VideoEvent.PLAYING)
                   videoscrub.value=videoScreen.playheadTime;
           }
           private function scrubVideo(evt:Event):void{
               //trace("scrubbing " +videoscrub.value);

               videoScreen.playheadTime=videoscrub.value;

           }

           private function scrubbingComplete(evt:Event):void{
               trace("mouse up");
               videoScreen.play();
           }

           private function pauseVideo(evt:Event):void{
               trace("mouse down");
               videoScreen.pause();

           }

           private function onReleaseOutside(evt:Event):void{
               trace("mouse down outside");

               videoScreen.play();
           }


       ]]>
   </mx:Script>
   <!-- Main container -->
   <mx:VBox
           width="100%"
           verticalAlign="middle" >
       <mx:VideoDisplay id="videoScreen"
                        width="320" height="240" source="data/video.flv"
                        stateChange="onVideoStateChangeHandler(event);"
                        playheadUpdate="updateSlider(event);"
       />

       <mx:HSlider id="videoscrub" width="320"
                   maximum="{videoScreen.totalTime}"  liveDragging="true"
                   change="scrubVideo(event);"
mouseUp="scrubbingComplete(event);"
                   mouseDown="pauseVideo(event);"
mouseDownOutside="onReleaseOutside(event);"
       />

       <mx:HBox width="100%">
           <mx:Button label="Play" click="playVideo(event);"/>
           <mx:Button label="Stop" click="stopVideo(event);"/>
       </mx:HBox>
   </mx:VBox>
</mx:Application>

Reply via email to