Changeset 970


Ignore:
Timestamp:
04/28/10 19:40:24 (3 years ago)
Author:
pablo
Message:

Addresses a few player bugs:

  • Calling play() in response to PLAYER_READY event causes video not to be displayed (818)
  • rtmp.subscribe not working with bandwidth detection / switching (831)
  • YouTube playlists displaying some visual artifacts when switching between playlist items (809)
Location:
trunk/fl5
Files:
8 edited

Legend:

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

    r919 r970  
    6161                /** Load after unlock - My favorite variable ever **/ 
    6262                protected var _unlockAndLoad:Boolean; 
     63                /** Whether the playlist has been loaded yet **/ 
     64                protected var _playlistReady:Boolean = false; 
    6365                 
    6466                 
     
    147149                                _setupFinalized = true; 
    148150 
    149                                 dispatchEvent(new PlayerEvent(PlayerEvent.JWPLAYER_READY)); 
    150  
    151151                                _player.addEventListener(PlaylistEvent.JWPLAYER_PLAYLIST_LOADED, playlistLoadHandler); 
    152152                                _player.addEventListener(ErrorEvent.ERROR, errorHandler); 
    153153                                _player.addEventListener(PlaylistEvent.JWPLAYER_PLAYLIST_ITEM, playlistItemHandler); 
    154  
     154                                 
    155155                                _model.addEventListener(MediaEvent.JWPLAYER_MEDIA_COMPLETE, completeHandler); 
     156                                 
     157                                dispatchEvent(new PlayerEvent(PlayerEvent.JWPLAYER_READY)); 
    156158 
    157159                                // Broadcast playlist loaded (which was swallowed during player setup); 
     
    160162                                } 
    161163 
     164                                 
    162165                        } 
    163166                } 
     
    165168 
    166169                protected function playlistLoadHandler(evt:PlaylistEvent=null):void { 
     170                        _playlistReady = true; 
     171                         
    167172                        if (_model.config.shuffle) { 
    168173                                shuffleItem(); 
     
    322327 
    323328                public function play():Boolean { 
     329                        if (!_playlistReady) { 
     330                                Logger.log("Attempted to begin playback before playlist is ready"); 
     331                                return false; 
     332                        } 
     333                         
    324334                        if (_mediaLoader) { 
    325335                                _delayedItem = _model.playlist.currentItem; 
  • trunk/fl5/src/com/longtailvideo/jwplayer/controller/PlayerSetup.as

    r836 r970  
    7272                        tasker.addEventListener(ErrorEvent.ERROR, setupTasksFailed); 
    7373                         
    74                         tasker.queueTask(insertDelay); 
    7574                        tasker.queueTask(loadConfig, loadConfigComplete); 
    7675                        tasker.queueTask(loadSkin, loadSkinComplete); 
     
    104103                /////////////////////// 
    105104                 
    106                 protected function insertDelay():void { 
    107                         var timer:Timer = new Timer(100, 1); 
    108                         timer.addEventListener(TimerEvent.TIMER_COMPLETE, tasker.success); 
    109                         timer.start(); 
    110                 } 
    111  
    112105                protected function loadConfig():void { 
    113106                        var configger:Configger = new Configger(); 
  • trunk/fl5/src/com/longtailvideo/jwplayer/media/RTMPMediaProvider.as

    r940 r970  
    256256                                        sendMediaEvent(MediaEvent.JWPLAYER_MEDIA_ERROR,{message: "Subscription failed: " + item.file});  
    257257                } else if (dat.code == "NetStream.Play.Start") { 
    258                     setStream(); 
     258                                        if (item.levels.length > 0) { 
     259                                                if (_dynamic || _bandwidthChecked) { 
     260                                                        setStream(); 
     261                                                } else { 
     262                                                        _bandwidthChecked = true; 
     263                                                        _bandwidthSwitch = true; 
     264                                                        _connection.call('checkBandwidth', null); 
     265                                                } 
     266                                        } else { 
     267                                                setStream(); 
     268                                        } 
    259269                } 
    260270                clearInterval(_subscribeInterval); 
     
    384394                } 
    385395            } 
     396                         
    386397                        if (state == PlayerState.PAUSED) { 
    387398                                play(); 
    388399                        } 
    389             if (getConfigProperty('subscribe')) { 
    390                 _stream.play(getID(item.file)); 
    391                         } else if(isDVR) { 
     400                         
     401                        if(isDVR) { 
    392402                                if(state != PlayerState.PLAYING) { 
    393403                                        try { 
  • trunk/fl5/src/com/longtailvideo/jwplayer/media/YouTubeMediaProvider.as

    r910 r970  
    151151                override public function play():void { 
    152152                        _outgoing.send('AS3_' + _unique, "playVideo"); 
    153 //                      super.play(); 
     153                        super.play(); 
    154154                } 
    155155 
     
    200200                        _bufferPercent = Math.round(ldd / ttl * 100); 
    201201                        _offset = off / ttl * item.duration; 
    202                         sendBufferEvent(_bufferPercent, _offset); 
     202                        sendBufferEvent(_bufferPercent, _offset, {loaded:ldd, total:ttl}); 
    203203                } 
    204204 
     
    209209                        if (item.duration < 0) { 
    210210                                item.duration = dur; 
    211                         } 
    212                         if (state != PlayerState.PLAYING){ 
    213                                 super.play(); 
    214211                        } 
    215212                        sendMediaEvent(MediaEvent.JWPLAYER_MEDIA_TIME, {position: pos, duration: item.duration, offset: _offset}); 
  • trunk/fl5/src/com/longtailvideo/jwplayer/player/Player.as

    r961 r970  
    1616        import flash.display.Sprite; 
    1717        import flash.events.Event; 
     18        import flash.utils.setTimeout; 
    1819         
    1920         
     
    7273                        // Only handle JWPLAYER_READY once 
    7374                        controller.removeEventListener(PlayerEvent.JWPLAYER_READY, playerReady); 
     75                         
     76                        // Initialize Javascript interface 
    7477                        var jsAPI:JavascriptAPI = new JavascriptAPI(this); 
     78                         
     79                        // Forward all MVC events 
    7580                        model.addGlobalListener(forward); 
    7681                        view.addGlobalListener(forward); 
    7782                        controller.addGlobalListener(forward); 
    78                         forward(evt); 
     83 
     84                        // Insert a delay to allow Javascript listeners to initialize  
     85                        setTimeout(forward, 50, evt); 
    7986                } 
    8087                 
  • trunk/fl5/src/com/longtailvideo/jwplayer/player/PlayerVersion.as

    r961 r970  
    33         
    44        public class PlayerVersion { 
    5                 protected static var _version:String = "5.2.961"; 
     5                protected static var _version:String = "5.2.970"; 
    66                 
    77                public static function get version():String { 
  • trunk/fl5/src/com/longtailvideo/jwplayer/view/View.as

    r956 r970  
    454454                                                _imageLayer.visible = false; 
    455455                                        } 
     456                                        if (_logo) _logo.visible = true; 
     457                                        break; 
    456458                                case PlayerState.BUFFERING: 
    457459                                        if (_logo) _logo.visible = true; 
Note: See TracChangeset for help on using the changeset viewer.