update slider as the video plays, and preserve playing state during slider drags
authorRichard Fairhurst <richard@systemed.net>
Fri, 18 Feb 2011 15:29:41 +0000 (15:29 +0000)
committerRichard Fairhurst <richard@systemed.net>
Fri, 18 Feb 2011 15:29:41 +0000 (15:29 +0000)
net/systemeD/potlatch2/help/VideoPlayer.mxml

index 866b0561e2bacb1781f928486a3c0a7d81bcd611..fdb6f89e5f907da671dcc9fca21d216ce5a27e06 100644 (file)
@@ -8,6 +8,7 @@
                <mx:Box id="videoContainer">
                        <mx:VideoDisplay id="video" 
                                metadataReceived="prepareVideo()"
+                               playheadUpdate="advanceProgress(event)"
                                click="playVideo()"
                                autoPlay="false"
                                width="100%" height="100%" />
                                the user actually wants it.)
                        */
 
+                       import mx.events.VideoEvent;
+
                        [Bindable] public var file:String;
                        [Bindable] public var previewImage:String; 
+                       private var wasPlaying:Boolean;
 
                        [Bindable] [Embed(source="../../../../embedded/video_play.png" )] public var playImage:Class;
                        [Bindable] [Embed(source="../../../../embedded/video_pause.png")] public var pauseImage:Class;
                                progressBar.maximum=video.totalTime;
                        }
                        public function progressThumbPress(event:Event):void { 
+                               wasPlaying=video.playing;
                                video.pause();
                                playButton.source=playImage;
                        }
                        public function progressThumbRelease(event:Event):void { 
                                video.playheadTime = event.currentTarget.value; 
+                               if (wasPlaying) playVideo();
                        } 
+                       public function advanceProgress(event:VideoEvent):void {
+                               progressBar.value = event.playheadTime;
+                       }
                        public function stopPlaying():void {
                                if (!video.playing) return;
                                video.pause();