Changeset 612


Ignore:
Timestamp:
11/11/09 20:40:25 (4 years ago)
Author:
pablo
Message:

Implemented fading for PNG controlbar
Disabled PNG volume slider when player is muted.

Location:
trunk/fl5
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/fl5/src/com/longtailvideo/jwplayer/player/PlayerVersion.as

    r610 r612  
    33         
    44        public class PlayerVersion { 
    5                 protected static var _version:String = "5.0.610 beta"; 
     5                protected static var _version:String = "5.0.611 beta"; 
    66                 
    77                public static function get version():String{ 
  • trunk/fl5/src/com/longtailvideo/jwplayer/view/components/ControlbarComponent.as

    r610 r612  
    77        import com.longtailvideo.jwplayer.player.IPlayer; 
    88        import com.longtailvideo.jwplayer.player.PlayerState; 
     9        import com.longtailvideo.jwplayer.plugins.PluginConfig; 
     10        import com.longtailvideo.jwplayer.utils.Animations; 
    911        import com.longtailvideo.jwplayer.utils.Draw; 
    1012        import com.longtailvideo.jwplayer.utils.Strings; 
     
    2022        import flash.text.TextFormat; 
    2123        import flash.ui.Mouse; 
     24        import flash.utils.clearTimeout; 
     25        import flash.utils.setTimeout; 
    2226 
    2327 
     
    9195                protected var _height:Number; 
    9296 
    93  
     97                protected var controlbarConfig:PluginConfig; 
     98                protected var animations:Animations; 
     99                protected var hiding:Number; 
     100                 
    94101                public function ControlbarComponent(player:IPlayer) { 
    95102                        super(player, "controlbar"); 
     
    102109                        setTime(0, 0); 
    103110                        updateVolumeSlider(); 
    104                 } 
    105  
     111                        controlbarConfig = _player.config.pluginConfig(_name); 
     112                        animations = new Animations(this); 
     113                } 
    106114 
    107115                private function addEventListeners():void { 
     
    136144                } 
    137145 
    138  
    139                 private function stateHandler(evt:PlayerEvent):void { 
     146                 
     147                private function startFader():void { 
     148                        if (controlbarConfig['position'] == 'over' || (_player.fullscreen && controlbarConfig['position'] != 'none')) { 
     149                                if (!isNaN(hiding)) { 
     150                                        clearTimeout(hiding); 
     151                                } 
     152                                hiding = setTimeout(moveTimeout, 2000); 
     153                                _player.controls.display.addEventListener(MouseEvent.MOUSE_MOVE, moveHandler); 
     154                        } 
     155                } 
     156                 
     157                private function stopFader():void { 
     158                        if (!isNaN(hiding)) { 
     159                                clearTimeout(hiding); 
     160                                try { 
     161                                        _player.controls.display.removeEventListener(MouseEvent.MOUSE_MOVE, moveHandler); 
     162                                } catch (e:Error) {} 
     163                        } 
     164                        Mouse.show(); 
     165                        animations.fade(1, 0.5); 
     166                } 
     167                 
     168                /** Show above controlbar on mousemove. **/ 
     169                private function moveHandler(evt:MouseEvent=null):void { 
     170                        if (alpha == 0) { 
     171                                animations.fade(1, 0.5); 
     172                        } 
     173                        clearTimeout(hiding); 
     174                        hiding = setTimeout(moveTimeout, 2000); 
     175                        Mouse.show(); 
     176                } 
     177                 
     178                 
     179                /** Hide above controlbar again when move has timed out. **/ 
     180                private function moveTimeout():void { 
     181                        animations.fade(0, 0.5); 
     182                        Mouse.hide(); 
     183                } 
     184                 
     185                private function stateHandler(evt:PlayerEvent=null):void { 
     186                        switch(_player.state) { 
     187                                case PlayerState.BUFFERING: 
     188                                case PlayerState.PLAYING: 
     189                                        startFader(); 
     190                                        break; 
     191                                case PlayerState.PAUSED: 
     192                                case PlayerState.IDLE: 
     193                                        stopFader(); 
     194                                        break; 
     195                        } 
    140196                        updateControlbarState(); 
    141197                        redraw(); 
     
    356412 
    357413                private function volumeHandler(evt:ViewEvent):void { 
    358                         var volume:Number = Math.round(evt.data * 100); 
    359                         if (!_player.locked) { 
    360                                 var volumeEvent:MediaEvent = new MediaEvent(MediaEvent.JWPLAYER_MEDIA_VOLUME); 
    361                                 volumeEvent.volume = volume; 
    362                                 updateVolumeSlider(volumeEvent); 
    363                         } 
    364                         dispatchEvent(new ViewEvent(ViewEvent.JWPLAYER_VIEW_VOLUME, volume)); 
     414                        if (!_player.mute) { 
     415                                var volume:Number = Math.round(evt.data * 100); 
     416                                if (!_player.locked) { 
     417                                        var volumeEvent:MediaEvent = new MediaEvent(MediaEvent.JWPLAYER_MEDIA_VOLUME); 
     418                                        volumeEvent.volume = volume; 
     419                                        updateVolumeSlider(volumeEvent); 
     420                                } 
     421                                dispatchEvent(new ViewEvent(ViewEvent.JWPLAYER_VIEW_VOLUME, volume)); 
     422                        } 
    365423                } 
    366424 
     
    491549                        setChildIndex(capRight, numChildren - 1); 
    492550 
    493                         updateControlbarState(); 
     551                        stopFader(); 
     552                        stateHandler(); 
    494553                        redraw(); 
    495                         Mouse.show(); 
    496554                } 
    497555 
  • trunk/fl5/src/com/longtailvideo/jwplayer/view/components/ControlbarComponentV4.as

    r609 r612  
    142142                } 
    143143 
    144  
    145144                public function resize(width:Number, height:Number):void { 
    146145                        if (!(PlayerLayoutManager.testPosition(controlbarConfig['position']) || controlbarConfig['position'] == "over")) { 
     
    222221                                        stage.addEventListener(MouseEvent.MOUSE_UP, upHandler); 
    223222                                } else { 
    224                                         scrubber = undefined; 
     223                                        scrubber = null; 
    225224                                } 
    226225                        } 
     
    242241                        fixTime(); 
    243242                } 
    244  
    245  
    246                 /** Show above controlbar on mousemove. **/ 
    247                 private function moveHandler(evt:MouseEvent=null):void { 
    248                         if (alpha == 0) { 
    249                                 animations.fade(1); 
    250                         } 
    251                         clearTimeout(hiding); 
    252                         hiding = setTimeout(moveTimeout, 2000); 
    253                         Mouse.show(); 
    254                 } 
    255  
    256  
    257                 /** Hide above controlbar again when move has timed out. **/ 
    258                 private function moveTimeout():void { 
    259                         animations.fade(0); 
    260                         Mouse.hide(); 
    261                 } 
    262  
    263243 
    264244                /** Show a mute icon if playing. **/ 
     
    376356                } 
    377357 
     358                 
    378359                private function startFader():void { 
    379360                        if (controlbarConfig['position'] == 'over' || (_player.fullscreen && controlbarConfig['position'] != 'none')) { 
     
    396377                        animations.fade(1); 
    397378                } 
    398  
     379                 
     380                /** Show above controlbar on mousemove. **/ 
     381                private function moveHandler(evt:MouseEvent=null):void { 
     382                        if (alpha == 0) { 
     383                                animations.fade(1); 
     384                        } 
     385                        clearTimeout(hiding); 
     386                        hiding = setTimeout(moveTimeout, 2000); 
     387                        Mouse.show(); 
     388                } 
     389                 
     390                 
     391                /** Hide above controlbar again when move has timed out. **/ 
     392                private function moveTimeout():void { 
     393                        animations.fade(0); 
     394                        Mouse.hide(); 
     395                } 
     396                 
    399397                /** Process state changes **/ 
    400                 private function stateHandler(evt:PlayerEvent=undefined):void { 
     398                private function stateHandler(evt:PlayerEvent=null):void { 
    401399                        // TODO: Fix non-working fading 
    402400                        clearTimeout(hiding); 
    403401                        try { 
    404                                 var dps:String = stage['displayState']; 
    405  
    406402                                switch (_player.state) { 
    407403                                        case PlayerState.PLAYING: 
     
    531527                        } 
    532528                        var pct:Number = (scrubber.icon.x - scrubber.rail.x) / (scrubber.rail.width - scrubber.icon.width) * mpl; 
    533                         scrubber = undefined; 
     529                        scrubber = null; 
    534530                        if (sliderType == 'volumeSlider') { 
    535531                                var volumeEvent:MediaEvent = new MediaEvent(MediaEvent.JWPLAYER_MEDIA_VOLUME); 
Note: See TracChangeset for help on using the changeset viewer.