Changeset 1246


Ignore:
Timestamp:
08/27/10 20:34:54 (3 years ago)
Author:
pablo
Message:

Bug fixes:

  • Fixes loading "0" plugin when plugin flashvar is blank (1025)
  • Fixes blank screen on PLAY from JavaScript API (1001)
  • Fixes sound files being truncated if STOP is called before loading is complete (982)
  • Fixes item events not being forwarded to JS after playerReady (1029)
Location:
trunk/fl5
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/fl5/src/com/longtailvideo/jwplayer/controller/PluginLoader.as

    r719 r1246  
    4343                 
    4444                public function loadPlugins(pluginList:String):void { 
    45                         var plugins:Array = pluginList.replace(/\s*/g,"").split(","); 
    46                         for each(var plugin:String in plugins) { 
    47                                 loadLocalPlugin(plugin); //Testing 
     45                        if (pluginList) { 
     46                                var plugins:Array = pluginList.replace(/\s*/g,"").split(","); 
     47                                for each(var plugin:String in plugins) { 
     48                                        loadLocalPlugin(plugin); //Testing 
     49                                } 
     50                        } else { 
     51                                dispatchEvent(new Event(Event.COMPLETE)); 
    4852                        } 
    4953                } 
  • trunk/fl5/src/com/longtailvideo/jwplayer/media/SoundMediaProvider.as

    r1223 r1246  
    2929                /** Whether the buffer has filled **/ 
    3030                private var _bufferFull:Boolean; 
    31                 /** Whether the enitre video has been buffered **/ 
     31                /** Whether the enitre sound file has been buffered **/ 
    3232                private var _bufferingComplete:Boolean; 
    3333                /** User-defined item duration **/ 
     
    7979                        _position = 0; 
    8080                        _bufferFull = false; 
    81                         _bufferingComplete = false; 
    8281                        _userDuration = itm.duration > 0 ? itm.duration : -1; 
    83                         if (!_item || _item.file != itm.file) { 
     82                        if (!_item || _item.file != itm.file || !_bufferingComplete) { 
     83                                _bufferingComplete = false; 
    8484                                _item = itm; 
    8585                                _sound = new Sound(); 
  • trunk/fl5/src/com/longtailvideo/jwplayer/model/PlayerConfig.as

    r1207 r1246  
    6868                public function setConfig(config:Object):void { 
    6969                        for (var item:String in config) { 
    70                                 item = item; 
    7170                                if (item.indexOf(".") > 0) { 
    7271                                        setPluginProperty(item, config[item]); 
  • trunk/fl5/src/com/longtailvideo/jwplayer/player/IPlayer.as

    r1238 r1246  
    11package com.longtailvideo.jwplayer.player { 
     2        import com.longtailvideo.jwplayer.events.IGlobalEventDispatcher; 
    23        import com.longtailvideo.jwplayer.model.IPlaylist; 
    34        import com.longtailvideo.jwplayer.model.PlayerConfig; 
     
    67        import com.longtailvideo.jwplayer.view.interfaces.IPlayerComponent; 
    78        import com.longtailvideo.jwplayer.view.interfaces.ISkin; 
    8  
     9         
    910        import flash.events.IEventDispatcher; 
    1011 
     
    1516         * @author Zachary Ozer 
    1617         */ 
    17         public interface IPlayer extends IEventDispatcher { 
     18        public interface IPlayer extends IEventDispatcher, IGlobalEventDispatcher { 
    1819                /** 
    1920                 * The player's current configuration 
  • trunk/fl5/src/com/longtailvideo/jwplayer/player/JavascriptAPI.as

    r1228 r1246  
    11package com.longtailvideo.jwplayer.player { 
    2         import com.longtailvideo.jwplayer.events.GlobalEventDispatcher; 
    3         import com.longtailvideo.jwplayer.events.IGlobalEventDispatcher; 
    42        import com.longtailvideo.jwplayer.events.MediaEvent; 
    53        import com.longtailvideo.jwplayer.events.PlayerEvent; 
     
    1715        import flash.external.ExternalInterface; 
    1816        import flash.utils.Timer; 
     17        import flash.utils.setTimeout; 
    1918         
    2019        public class JavascriptAPI { 
     
    3534                        setupPlayerListeners(); 
    3635                        setupJSListeners(); 
     36                        _player.addGlobalListener(queueEvents); 
     37                         
    3738                } 
    3839                 
    3940                /** Delay the response to PlayerReady to allow the external interface to initialize in some browsers **/ 
    4041                protected function playerReady(evt:PlayerEvent):void { 
    41                         (_player as IGlobalEventDispatcher).addGlobalListener(queueEvents); 
    42                          
    4342                        var timer:Timer = new Timer(50, 1); 
    4443                         
    4544                        timer.addEventListener(TimerEvent.TIMER_COMPLETE, function(timerEvent:TimerEvent):void { 
     45                                _player.removeGlobalListener(queueEvents); 
    4646                                var callbacks:String = _player.config.playerready ? _player.config.playerready + "," + "playerReady" : "playerReady";   
    4747                                if (ExternalInterface.available) { 
     
    5656                                        } 
    5757                                         
    58                                         for each (var queuedEvent:PlayerEvent in _queuedEvents) { 
    59                                                 listenerCallback(queuedEvent); 
    60                                         } 
    61                                         _queuedEvents = null; 
    62                                          
     58                                        clearQueuedEvents(); 
    6359                                } 
    6460                                 
    65                                 (_player as IGlobalEventDispatcher).removeGlobalListener(queueEvents); 
    6661 
    6762                        }); 
     
    7166                protected function queueEvents(evt:PlayerEvent):void { 
    7267                        _queuedEvents.push(evt); 
     68                } 
     69                 
     70                protected function clearQueuedEvents():void { 
     71                        for each (var queuedEvent:PlayerEvent in _queuedEvents) { 
     72                                listenerCallback(queuedEvent); 
     73                        } 
     74                        _queuedEvents = null; 
    7375                } 
    7476                 
     
    175177                        var callbacks:Array = _listeners[evt.type] as Array; 
    176178                         
    177                         if (callbacks) { 
    178                                 for each (var call:String in callbacks) { 
    179                                         ExternalInterface.call(call, args); 
    180                                 } 
    181                         } 
     179                        //Insert 1ms delay to allow all Flash listeners to complete before notifying JavaScript 
     180                        setTimeout(function():void { 
     181                                if (callbacks) { 
     182                                        for each (var call:String in callbacks) { 
     183                                                ExternalInterface.call(call, args); 
     184                                        } 
     185                                } 
     186                        }, 1); 
    182187                         
    183188                } 
  • trunk/fl5/src/com/longtailvideo/jwplayer/player/JavascriptCompatibilityAPI.as

    r1214 r1246  
    99         
    1010        import flash.external.ExternalInterface; 
     11        import flash.utils.setTimeout; 
    1112 
    1213 
     
    4647                        } 
    4748 
     49                } 
     50                 
     51                override protected function clearQueuedEvents():void { 
     52                        super.clearQueuedEvents(); 
     53                        var eventInfo:PlayerEvent = new PlayerEvent(""); 
     54                        forwardControllerEvents(new ControllerEvent(ControllerEvent.PLAYLIST, {playlist:JavascriptSerialization.playlistToArray(_player.playlist), id:eventInfo.id, client:eventInfo.client, version:eventInfo.version})); 
     55                        forwardControllerEvents(new ControllerEvent(ControllerEvent.ITEM, {index:_player.playlist.currentIndex, id:eventInfo.id, client:eventInfo.client, version:eventInfo.version})); 
    4856                } 
    4957                 
     
    133141                 
    134142                private function forwardControllerEvents(evt:ControllerEvent):void { 
    135                         if (controllerCallbacks.hasOwnProperty(evt.type)) { 
    136                                 for each (var callback:String in controllerCallbacks[evt.type]) { 
    137                                         if (ExternalInterface.available) { 
    138                                                 ExternalInterface.call(callback, JavascriptSerialization.stripDots(evt.data)); 
     143                        //Insert 1ms delay to allow all Flash listeners to complete before notifying JavaScript 
     144                        setTimeout(function():void { 
     145                                if (controllerCallbacks.hasOwnProperty(evt.type)) { 
     146                                        for each (var callback:String in controllerCallbacks[evt.type]) { 
     147                                                if (ExternalInterface.available) { 
     148                                                        ExternalInterface.call(callback, JavascriptSerialization.stripDots(evt.data)); 
     149                                                } 
    139150                                        } 
    140151                                } 
    141                         } 
     152                        }, 1); 
    142153                } 
    143154 
    144155                private function forwardModelEvents(evt:ModelEvent):void { 
    145                         if (modelCallbacks.hasOwnProperty(evt.type)) { 
    146                                 for each (var callback:String in modelCallbacks[evt.type]) { 
    147                                         if (ExternalInterface.available) { 
    148                                                 ExternalInterface.call(callback, JavascriptSerialization.stripDots(evt.data)); 
     156                        //Insert 1ms delay to allow all Flash listeners to complete before notifying JavaScript 
     157                        setTimeout(function():void { 
     158                                if (modelCallbacks.hasOwnProperty(evt.type)) { 
     159                                        for each (var callback:String in modelCallbacks[evt.type]) { 
     160                                                if (ExternalInterface.available) { 
     161                                                        ExternalInterface.call(callback, JavascriptSerialization.stripDots(evt.data)); 
     162                                                } 
    149163                                        } 
    150164                                } 
    151                         } 
     165                        }, 1); 
    152166                } 
    153167 
    154168                private function forwardViewEvents(evt:ViewEvent):void { 
    155                         if (viewCallbacks.hasOwnProperty(evt.type)) { 
    156                                 for each (var callback:String in viewCallbacks[evt.type]) { 
    157                                         if (ExternalInterface.available) { 
    158                                                 ExternalInterface.call(callback, JavascriptSerialization.stripDots(evt.data)); 
     169                        //Insert 1ms delay to allow all Flash listeners to complete before notifying JavaScript 
     170                        setTimeout(function():void { 
     171                                if (viewCallbacks.hasOwnProperty(evt.type)) { 
     172                                        for each (var callback:String in viewCallbacks[evt.type]) { 
     173                                                if (ExternalInterface.available) { 
     174                                                        ExternalInterface.call(callback, JavascriptSerialization.stripDots(evt.data)); 
     175                                                } 
    159176                                        } 
    160177                                } 
    161                         } 
     178                        }, 1); 
    162179                } 
    163180 
  • trunk/fl5/src/com/longtailvideo/jwplayer/player/PlayerV4Emulation.as

    r1214 r1246  
    7777                 
    7878                private function setupListeners():void { 
    79                          
    80                         var m:Model; 
    81                         var v:IControlbarComponent; 
    82                         var c:Controller 
    83                          
    8479                        _player.addEventListener(PlayerEvent.JWPLAYER_ERROR, errorHandler); 
    8580                         
  • trunk/fl5/src/com/longtailvideo/jwplayer/player/PlayerVersion.as

    r1243 r1246  
    33         
    44        public class PlayerVersion { 
    5                 protected static var _version:String = "5.3.1243"; 
     5                protected static var _version:String = "5.3.1246"; 
    66                 
    77                public static function get version():String { 
  • trunk/fl5/src/com/longtailvideo/jwplayer/utils/Strings.as

    r1054 r1246  
    7676                        } else if (val == 'false') { 
    7777                                return false; 
    78                         } else if (isNaN(Number(val)) || val.length > 5) { 
     78                        } else if (isNaN(Number(val)) || val.length > 5 || val.length == 0) { 
    7979                                return val; 
    8080                        } else { 
  • trunk/fl5/src/com/longtailvideo/jwplayer/view/components/ControlbarComponent.as

    r1238 r1246  
    192192                /** Show above controlbar on mousemove and restart the countdown. **/ 
    193193                private function moveHandler(evt:MouseEvent=null):void { 
    194                         if (alpha == 0) { 
    195                                 stopFader(); 
     194                        stopFader(); 
     195                        if (_player.state == PlayerState.BUFFERING || _player.state == PlayerState.PLAYING || hideOnIdle) { 
    196196                                startFader(); 
    197197                        } 
     
    207207                private function mouseLeftStage(evt:Event=null):void { 
    208208                        if (fadeOnTimeout) { 
    209                                 if (_player.state == PlayerState.BUFFERING || _player.state == PlayerState.PLAYING || hideOnIdle) 
    210                                 animations.fade(0); 
     209                                if (_player.state == PlayerState.BUFFERING || _player.state == PlayerState.PLAYING || hideOnIdle) { 
     210                                        animations.fade(0); 
     211                                } 
    211212                        } 
    212213                } 
  • trunk/fl5/src/com/longtailvideo/jwplayer/view/components/ControlbarComponentV4.as

    r1238 r1246  
    403403                /** Show above controlbar on mousemove and restart the countdown. **/ 
    404404                private function moveHandler(evt:MouseEvent=null):void { 
    405                         if (alpha == 0) { 
    406                                 stopFader(); 
     405                        stopFader(); 
     406                        if (_player.state == PlayerState.BUFFERING || _player.state == PlayerState.PLAYING || hideOnIdle) { 
    407407                                startFader(); 
    408408                        } 
     
    418418                private function mouseLeftStage(evt:Event=null):void { 
    419419                        if (fadeOnTimeout) { 
    420                                 if (_player.state == PlayerState.BUFFERING || _player.state == PlayerState.PLAYING || hideOnIdle) 
     420                                if (_player.state == PlayerState.BUFFERING || _player.state == PlayerState.PLAYING || hideOnIdle) { 
    421421                                        animations.fade(0); 
     422                                } 
    422423                        } 
    423424                } 
     
    432433                                        startFader(); 
    433434                                        break; 
     435                                case PlayerState.IDLE: 
     436                                        timeHandler(); 
    434437                                case PlayerState.PAUSED: 
    435                                 case PlayerState.IDLE: 
    436438                                        getSkinComponent('playButton').visible = true; 
    437439                                        getSkinComponent('pauseButton').visible = false; 
Note: See TracChangeset for help on using the changeset viewer.