Changeset 853


Ignore:
Timestamp:
02/24/10 16:29:52 (3 years ago)
Author:
pablo
Message:

Fixing hd.state issue

Location:
branches/plugins/hd
Files:
2 edited

Legend:

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

    r852 r853  
    5050                        _player = player; 
    5151                        _config = cfg; 
    52                         if (config.state == 'true') { 
     52                        if (config.state.toString() == 'true') { 
    5353                                config.state = true; 
    5454                        } else { 
     
    5757                        _player.addEventListener(MediaEvent.JWPLAYER_MEDIA_TIME, timeHandler); 
    5858                        _player.addEventListener(PlaylistEvent.JWPLAYER_PLAYLIST_ITEM, itemHandler); 
    59                         if (config.state) { 
    60                                 config.file = config.file; 
    61                         } 
     59 
    6260                        if (_player.config.dock) { 
    6361                                if (_player.skin.getSkinElement('hd', 'dockIcon')) { 
     
    139137                /** Updates the playlist with either the HD or default video. **/ 
    140138                private function itemHandler(evt:Event=null):void { 
    141                         if (_currentItem != _player.playlist.currentItem) { 
     139                        if (_currentItem == null && config.state) { 
     140                                // Little hack to avoid re-loading the playlist on startup. 
     141                                _currentItem = _player.playlist.currentItem;  
     142                                _currentItem['hd.originalfile'] = _currentItem.file; 
     143                                _currentItem.file = swapFile; 
     144                        } else  if (_currentItem != _player.playlist.currentItem) { 
    142145                                _currentItem = _player.playlist.currentItem; 
    143146                        }  
     
    165168                        // Load a new playlist instead of changing the item's file property. 
    166169                        // This is necessary due to a bug in 5.0 that doesn't load a new file if the PlaylistItem object doesn't change. 
    167                         _player.load(newList); 
    168                         _player.play(); 
    169                         _player.seek(_position); 
     170                        if (_player.state == PlayerState.PLAYING || _player.state == PlayerState.BUFFERING) { 
     171                                _player.load(newList); 
     172                                _player.play(); 
     173                                _player.seek(_position); 
     174                        } else { 
     175                                _player.load(newList); 
     176                        } 
    170177                } 
    171178                 
Note: See TracChangeset for help on using the changeset viewer.