Changeset 1806


Ignore:
Timestamp:
05/26/11 14:29:28 (2 years ago)
Author:
pablo
Message:

Fixes a problem with single-item configurations and the OVA plugin

Location:
plugins/hd/v5
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • plugins/hd/v5/src/com/longtailvideo/plugins/hd/HD.as

    r1801 r1806  
    1212    import com.longtailvideo.jwplayer.plugins.PluginConfig; 
    1313    import com.longtailvideo.jwplayer.utils.Configger; 
    14  
     14     
    1515    import flash.display.DisplayObject; 
    1616    import flash.display.MovieClip; 
     
    119119            // Reset the reset. 
    120120            _reset = -1; 
    121             // Set the file flashvar to the first playlistitem. 
    122             if(_config.file) { 
    123                 _player.playlist.getItemAt(0)['hd.file'] = _config.file; 
    124             } 
     121                        // Which item should we apply the global 'hd.file' to? 
     122                        // We should skip ova.hidden items. 
     123                        var firstVisible:Number = 0; 
    125124            // Store all the original files into the playlist. 
    126125            for(var i:Number = 0; i < _player.playlist.length; i++) { 
    127126                var item:PlaylistItem = _player.playlist.getItemAt(i); 
     127                                if (item['ova.hidden']) { 
     128                                        // This item is hidden by OVA; we shouldn't set its hd.file property.  
     129                                        firstVisible++; 
     130                                } 
     131                                // Set the hd.file flashvar to the first playlistitem. 
     132                                if(i == firstVisible && _config.file) { 
     133                                        item['hd.file'] = _config.file; 
     134                                } 
    128135                if(item.provider == 'youtube') { 
    129136                    item['youtube.quality'] = 'medium'; 
     
    186193        /** Switch the currently playing file with a new one. **/ 
    187194        private function _swap():void { 
    188             // Swap HD state in every playlist item. 
    189             for(var i:Number = 0; i<_player.playlist.length; i++) { 
    190                 var item:PlaylistItem = _player.playlist.getItemAt(i); 
    191                  if (item.provider == 'youtube') { 
    192                     if(_config.state) { 
    193                         item['youtube.quality'] = 'hd720'; 
    194                     } else { 
    195                         item['youtube.quality'] = 'medium'; 
    196                     } 
    197                      
    198                 } else if(item['hd.file']) { 
    199                     if(_config.state) { 
    200                         item.file = item['hd.file']; 
    201                     } else { 
    202                         item.file = item['hd.original']; 
    203                     } 
    204                 } 
    205             } 
     195                        // Swap HD state in every playlist item. 
     196                        for(var i:Number = 0; i<_player.playlist.length; i++) { 
     197                                var item:PlaylistItem = _player.playlist.getItemAt(i); 
     198                                if (!item['ova.hidden']) { 
     199                                        if (item.provider == 'youtube') { 
     200                                                if(_config.state) { 
     201                                                        item['youtube.quality'] = 'hd720'; 
     202                                                } else { 
     203                                                        item['youtube.quality'] = 'medium'; 
     204                                                } 
     205                                                 
     206                                        } else if(item['hd.file']) { 
     207                                                if(_config.state) { 
     208                                                        item.file = item['hd.file']; 
     209                                                } else { 
     210                                                        item.file = item['hd.original']; 
     211                                                } 
     212                                        } 
     213                                } 
     214                        } 
    206215            // Restart player if not IDLE. 
    207216            if(_player.state != PlayerState.IDLE) { 
Note: See TracChangeset for help on using the changeset viewer.