Changeset 954


Ignore:
Timestamp:
04/26/10 14:00:38 (3 years ago)
Author:
pablo
Message:

Several bug fixes:

Location:
trunk/fl5
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/fl5/src/com/longtailvideo/jwplayer/media/HTTPMediaProvider.as

    r910 r954  
    254254                        var bufferPercent:Number; 
    255255                        var bufferFill:Number; 
    256                         if (item.duration > 0) { 
     256                        if (item.duration > 0 && _stream && _stream.bytesTotal > 0) { 
    257257                                percentoffset =  Math.round(_timeoffset /  item.duration * 100); 
    258258                                bufferPercent = (_stream.bytesLoaded / _stream.bytesTotal) * (1 - _timeoffset / item.duration) * 100; 
  • trunk/fl5/src/com/longtailvideo/jwplayer/media/SoundMediaProvider.as

    r835 r954  
    135135                        var bufferPercent:Number; 
    136136                         
    137                         if (_sound.bytesLoaded / _sound.bytesTotal > 0.1 && (_item.duration <= 0 || _userDuration < 0)) { 
     137                        if (_sound.bytesTotal > 0 && _sound.bytesLoaded / _sound.bytesTotal > 0.1 && (_item.duration <= 0 || _userDuration < 0)) { 
    138138                                _item.duration = _sound.length / 1000 / _sound.bytesLoaded * _sound.bytesTotal; 
    139139                        } 
    140140                         
    141                         if (_channel) { 
     141                        if (_channel && _sound && _sound.bytesTotal > 0) { 
    142142                                _position = Math.round(_channel.position / 100) / 10; 
    143143                                bufferPercent = Math.floor(_sound.bytesLoaded / _sound.bytesTotal * 100); 
    144                         } else if (!_channel && progressEvent) { 
     144                        } else if (!_channel && progressEvent && progressEvent.bytesTotal > 0) { 
    145145                                bufferPercent = Math.floor(progressEvent.bytesLoaded / progressEvent.bytesTotal * 100); 
     146                        } else { 
     147                                bufferPercent = 0; 
    146148                        } 
    147149                         
     
    183185                /** Seek in the _sound. **/ 
    184186                override public function seek(pos:Number):void { 
    185                         if (_sound && (pos < (_sound.bytesLoaded / _sound.bytesTotal) * item.duration) || item.start) { 
     187                        if (_sound && _sound.bytesTotal > 0 && (pos < (_sound.bytesLoaded / _sound.bytesTotal) * item.duration) || item.start) { 
    186188                                clearInterval(_positionInterval); 
    187189                                _positionInterval = undefined; 
  • trunk/fl5/src/com/longtailvideo/jwplayer/media/VideoMediaProvider.as

    r843 r954  
    150150                         
    151151                        var _streamTime:Number = Math.min(_stream.time, item.duration); 
    152                         var bufferPercent:Number = _stream.bytesLoaded / _stream.bytesTotal * 100; 
     152                        var bufferPercent:Number = _stream.bytesTotal > 0 ? _stream.bytesLoaded / _stream.bytesTotal * 100 : 0; 
    153153                        var bufferTime:Number = _stream.bufferTime < (item.duration - _streamTime) ? _stream.bufferTime : Math.floor(Math.abs(item.duration - _streamTime)); 
    154154                        var bufferFill:Number = bufferTime == 0 ? 100 : Math.floor(_stream.bufferLength / bufferTime * 100); 
     
    193193                                        config.bandwidth = bandwidth; 
    194194                                        var obj:Object = {bandwidth:bandwidth}; 
    195                                         if (item.duration > 0) { 
     195                                        if (item.duration > 0 && _stream.bytesTotal > 0) { 
    196196                                                obj.bitrate = Math.ceil(_stream.bytesTotal / 1024 * 8 / item.duration); 
    197197                                        } 
     
    215215                 
    216216                private function seekStream(pos:Number, ply:Boolean=true):void { 
    217                         var bufferLength:Number = _stream.bytesLoaded / _stream.bytesTotal * item.duration; 
     217                        var bufferLength:Number = _stream.bytesTotal > 0 ? (_stream.bytesLoaded / _stream.bytesTotal * item.duration) : 0; 
    218218                        if (pos <= bufferLength) { 
    219219                                super.seek(pos); 
  • trunk/fl5/src/com/longtailvideo/jwplayer/player/PlayerV4Emulation.as

    r842 r954  
    110110                 
    111111                private function errorHandler(evt:PlayerEvent):void { 
     112                        modelEventDispatcher.dispatchEvent(new ModelEvent(ModelEvent.ERROR, {message:evt.message, id:id, client:client, version:version})); 
    112113                        controllerEventDispatcher.dispatchEvent(new ControllerEvent(ControllerEvent.ERROR, {message:evt.message, id:id, client:client, version:version})); 
    113114                } 
     
    121122                private function mediaError(evt:MediaEvent):void { 
    122123                        modelEventDispatcher.dispatchEvent(new ModelEvent(ModelEvent.ERROR, {message:evt.message, id:id, client:client, version:version})); 
     124                        controllerEventDispatcher.dispatchEvent(new ControllerEvent(ControllerEvent.ERROR, {message:evt.message, id:id, client:client, version:version})); 
    123125                } 
    124126                 
  • trunk/fl5/src/com/longtailvideo/jwplayer/player/PlayerVersion.as

    r941 r954  
    33         
    44        public class PlayerVersion { 
    5                 protected static var _version:String = "5.2.941"; 
     5                protected static var _version:String = "5.2.954"; 
    66                 
    77                public static function get version():String { 
  • trunk/fl5/src/com/longtailvideo/jwplayer/view/Logo.as

    r850 r954  
    9797                protected function loaderHandler(evt:Event):void { 
    9898                        if (getConfigParam('hide').toString() == "true") visible = false; 
    99                         addChild(loader); 
    100                         resize(_width, _height); 
    101                         outHandler(); 
     99                        if (loader is DisplayObject) { 
     100                                addChild(loader); 
     101                                resize(_width, _height); 
     102                                outHandler(); 
     103                        } else { 
     104                                Logger.log("Logo was not a display object"); 
     105                        } 
    102106                } 
    103107                 
  • trunk/fl5/src/com/longtailvideo/jwplayer/view/PlayerLayoutManager.as

    r548 r954  
    2828                        toLayout = []; 
    2929                        noLayout = []; 
    30                          
     30 
     31                        remainingSpace = new Rectangle(0, 0, width, height); 
     32 
    3133                        for each (var plugin:String in _player.config.pluginIds) { 
    3234                                addLayout(plugin); 
     
    3840                        addLayout('dock');       
    3941                         
    40                         remainingSpace = new Rectangle(0, 0, width, height); 
    4142                        generateLayout(); 
    4243                }  
     
    4445 
    4546                private function addLayout(plugin:String):void { 
    46                         var cfg:PluginConfig = _player.config.pluginConfig(plugin);  
    47                         if (!_player.fullscreen && testPosition(cfg['position']) && Number(cfg['size']) > 0 ) { 
     47                        var cfg:PluginConfig = _player.config.pluginConfig(plugin); 
     48                         
     49                        if (!_player.fullscreen && testPosition(cfg['position']) && cfg['size']) { 
    4850                                toLayout.push(cfg); 
    4951                        } else { 
    5052                                noLayout.push(cfg); 
    5153                        } 
     54                } 
     55                 
     56                private function fitsLayout(config:PluginConfig):Boolean { 
     57                        switch (testPosition(config['position'])) { 
     58                                case BOTTOM: 
     59                                case TOP: 
     60                                        var controlbarConfig:PluginConfig = _player.config.pluginConfig('controlbar'); 
     61                                        if (config['id'] != "controlbar" && (testPosition(controlbarConfig['position']) == TOP || testPosition(controlbarConfig['position']) == BOTTOM)) { 
     62                                                return ((remainingSpace.height - controlbarConfig['size']) > Number(config['size']) > 0); 
     63                                        } else { 
     64                                                return (remainingSpace.height > Number(config['size']) > 0); 
     65                                        } 
     66                                        break; 
     67                                case LEFT: 
     68                                case RIGHT: 
     69                                        var playlistConfig:PluginConfig = _player.config.pluginConfig('playlist'); 
     70                                        if (config['id'] != "playlist" && (testPosition(playlistConfig['position']) == LEFT || testPosition(playlistConfig['position']) == RIGHT)) { 
     71                                                return ((remainingSpace.width - playlistConfig['size']) > Number(config['size']) > 0); 
     72                                        } else { 
     73                                                return (remainingSpace.width > Number(config['size']) > 0); 
     74                                        } 
     75                                        break; 
     76                        } 
     77                         
     78                        return false; 
     79                         
    5280                } 
    5381 
     
    81109                        var config:PluginConfig = toLayout.shift() as PluginConfig; 
    82110                        var pluginSpace:Rectangle = new Rectangle(); 
    83                         var position:String = testPosition(config['position']); 
    84111                        var size:Number = config['size']; 
    85112                         
    86                         switch (position) { 
    87                                 case LEFT: 
    88                                         pluginSpace.x = remainingSpace.x; 
    89                                         pluginSpace.y = remainingSpace.y; 
    90                                         pluginSpace.width = size; 
    91                                         pluginSpace.height = remainingSpace.height; 
    92                                         remainingSpace.width -= size; 
    93                                         remainingSpace.x += size; 
    94                                         break; 
    95                                 case RIGHT: 
    96                                         pluginSpace.x = remainingSpace.x + remainingSpace.width - size; 
    97                                         pluginSpace.y = remainingSpace.y; 
    98                                         pluginSpace.width = size; 
    99                                         pluginSpace.height = remainingSpace.height; 
    100                                         remainingSpace.width -= size; 
    101                                         break; 
    102                                 case TOP: 
    103                                         pluginSpace.x = remainingSpace.x; 
    104                                         pluginSpace.y = remainingSpace.y; 
    105                                         pluginSpace.width = remainingSpace.width; 
    106                                         pluginSpace.height = size; 
    107                                         remainingSpace.height -= size; 
    108                                         remainingSpace.y += size; 
    109                                         break; 
    110                                 case BOTTOM: 
    111                                         pluginSpace.x = remainingSpace.x; 
    112                                         pluginSpace.y = remainingSpace.y + remainingSpace.height - size; 
    113                                         pluginSpace.width = remainingSpace.width; 
    114                                         pluginSpace.height = size; 
    115                                         remainingSpace.height -= size; 
    116                                         break; 
     113                        if (fitsLayout(config)) { 
     114                                switch (testPosition(config['position'])) { 
     115                                        case LEFT: 
     116                                                pluginSpace.x = remainingSpace.x; 
     117                                                pluginSpace.y = remainingSpace.y; 
     118                                                pluginSpace.width = size; 
     119                                                pluginSpace.height = remainingSpace.height; 
     120                                                remainingSpace.width -= size; 
     121                                                remainingSpace.x += size; 
     122                                                break; 
     123                                        case RIGHT: 
     124                                                pluginSpace.x = remainingSpace.x + remainingSpace.width - size; 
     125                                                pluginSpace.y = remainingSpace.y; 
     126                                                pluginSpace.width = size; 
     127                                                pluginSpace.height = remainingSpace.height; 
     128                                                remainingSpace.width -= size; 
     129                                                break; 
     130                                        case TOP: 
     131                                                pluginSpace.x = remainingSpace.x; 
     132                                                pluginSpace.y = remainingSpace.y; 
     133                                                pluginSpace.width = remainingSpace.width; 
     134                                                pluginSpace.height = size; 
     135                                                remainingSpace.height -= size; 
     136                                                remainingSpace.y += size; 
     137                                                break; 
     138                                        case BOTTOM: 
     139                                                pluginSpace.x = remainingSpace.x; 
     140                                                pluginSpace.y = remainingSpace.y + remainingSpace.height - size; 
     141                                                pluginSpace.width = remainingSpace.width; 
     142                                                pluginSpace.height = size; 
     143                                                remainingSpace.height -= size; 
     144                                                break; 
     145                                } 
     146 
     147                                config['visible'] = true; 
     148                                assignSpace(config, pluginSpace); 
     149                        } else { 
     150                                noLayout.push(config); 
    117151                        } 
    118  
    119                         config['visible'] = true; 
    120                         assignSpace(config, pluginSpace); 
    121152                         
    122153                        generateLayout(); 
Note: See TracChangeset for help on using the changeset viewer.