Changeset 796


Ignore:
Timestamp:
01/14/10 12:55:31 (3 years ago)
Author:
pablo
Message:
Location:
trunk/fl5
Files:
6 edited

Legend:

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

    r764 r796  
    1414        import flash.events.Event; 
    1515         
     16         
    1617        /** 
    1718         * Fired when a portion of the current media has been loaded into the buffer. 
     
    3334        [Event(name="jwplayerMediaError", type="com.longtailvideo.jwplayer.events.MediaEvent")] 
    3435        /** 
    35          * Fired after the MediaProvider has loaded an item into memory. 
     36         * Fired after the MediaProvider has successfully set up a connection to the media. 
    3637         * 
    3738         * @eventType com.longtailvideo.jwplayer.events.MediaEvent.JWPLAYER_MEDIA_LOADED 
     
    3940        [Event(name="jwplayerMediaLoaded", type="com.longtailvideo.jwplayer.events.MediaEvent")] 
    4041        /** 
    41          * Sent after a load() command has completed 
     42         * Sends the position and duration of the currently playing media. 
    4243         *  
    4344         * @eventType com.longtailvideo.jwplayer.events.MediaEvent.JWPLAYER_MEDIA_TIME 
     
    4546        [Event(name="jwplayerMediaTime", type="com.longtailvideo.jwplayer.events.MediaEvent")] 
    4647        /** 
    47          * Sends the position and duration of the currently playing media 
     48         * Fired after a volume change. 
    4849         *  
    4950         * @eventType com.longtailvideo.jwplayer.events.MediaEvent.JWPLAYER_MEDIA_VOLUME 
     
    5152        [Event(name="jwplayerMediaVolume", type="com.longtailvideo.jwplayer.events.MediaEvent")] 
    5253        /** 
    53          * Fired when the currently playing media has completed its playback 
     54         * Fired when the currently playing media has completed its playback. 
    5455         *  
    5556         * @eventType com.longtailvideo.jwplayer.events.MediaEvent.JWPLAYER_MEDIA_COMPLETE 
     
    6263         */ 
    6364        [Event(name="jwplayerPlayerState", type="com.longtailvideo.jwplayer.events.PlayerStateEvent")] 
    64  
     65         
    6566        public class MediaProvider extends Sprite implements IGlobalEventDispatcher { 
    6667                /** Reference to the player configuration. **/ 
     
    8283                /** Handles event dispatching **/ 
    8384                private var _dispatcher:GlobalEventDispatcher; 
    84  
     85                 
    8586                protected var _width:Number; 
    8687                protected var _height:Number; 
    87  
    88  
     88                 
     89                 
    8990                public function MediaProvider(provider:String) { 
    9091                        _provider = provider; 
    9192                        _dispatcher = new GlobalEventDispatcher(); 
    9293                } 
    93  
    94  
     94                 
     95                 
    9596                public function initializeMediaProvider(cfg:PlayerConfig):void { 
    9697                        _config = cfg; 
    9798                        _state = PlayerState.IDLE; 
    9899                } 
    99  
    100  
     100                 
     101                 
    101102                /** 
    102103                 * Load a new playlist item 
     
    107108                        dispatchEvent(new MediaEvent(MediaEvent.JWPLAYER_MEDIA_LOADED)); 
    108109                } 
    109  
    110  
    111                 /** Pause playback of the item. **/ 
    112                 public function pause():void { 
    113                         setState(PlayerState.PAUSED); 
    114                 } 
    115  
    116  
     110                 
     111                 
    117112                /** Resume playback of the item. **/ 
    118113                public function play():void { 
     
    122117                        } 
    123118                } 
    124  
    125  
     119                 
     120                 
     121                /** Pause playback of the item. **/ 
     122                public function pause():void { 
     123                        setState(PlayerState.PAUSED); 
     124                } 
     125                 
     126                 
    126127                /** 
    127128                 * Seek to a certain position in the item. 
     
    132133                        _position = pos; 
    133134                } 
    134  
    135  
     135                 
     136                 
    136137                /** Stop playing and loading the item. **/ 
    137138                public function stop():void { 
     
    142143                        } 
    143144                } 
    144  
    145  
     145                 
     146                 
    146147                /** 
    147148                 * Change the playback volume of the item. 
     
    152153                        sendMediaEvent(MediaEvent.JWPLAYER_MEDIA_VOLUME, {'volume': vol}); 
    153154                } 
    154  
    155  
     155                 
     156                 
    156157                /** 
    157158                 * Changes the mute state of the item. 
     
    163164                        sendMediaEvent(MediaEvent.JWPLAYER_MEDIA_MUTE, {'mute': mute}); 
    164165                } 
    165  
    166  
    167                 /** Completes video playback **/ 
    168                 protected function complete():void { 
    169                         stop(); 
    170                         sendMediaEvent(MediaEvent.JWPLAYER_MEDIA_COMPLETE); 
    171                 } 
    172  
    173  
    174                 /** Puts the video into a buffer state **/ 
    175                 protected function buffer():void { 
    176  
    177                 } 
    178  
    179  
    180                 /** Graphical representation of media **/ 
    181                 public function get display():DisplayObject { 
    182                         return _media; 
    183                 } 
    184  
    185  
    186                 /** Name of the MediaProvider. */ 
    187                 public function get provider():String { 
    188                         return _provider; 
    189                 } 
    190  
    191  
    192                 /** 
    193                  * Current state of the MediaProvider. 
    194                  * @see PlayerStates 
    195                  */ 
    196                 public function get state():String { 
    197                         return _state; 
    198                 } 
    199  
    200  
    201                 /** Currently playing PlaylistItem **/ 
    202                 public function get item():PlaylistItem { 
    203                         return _item; 
    204                 } 
    205  
    206  
    207                 /** Current position, in seconds **/ 
    208                 public function get position():Number { 
    209                         return _position; 
    210                 } 
    211  
    212  
    213                 /** 
    214                  * The current volume of the playing media 
    215                  * <p>Range: 0-100</p> 
    216                  */ 
    217                 public function get volume():Number { 
    218                         return _volume; 
    219                 } 
    220  
    221  
    222                 /** 
    223                  * The current config 
    224                  */ 
    225                 protected function get config():PlayerConfig { 
    226                         return _config; 
    227                 } 
    228  
    229  
     166                 
     167                 
    230168                /** 
    231169                 * Resizes the display. 
     
    241179                        } 
    242180                } 
    243  
    244  
     181                 
     182                 
     183                /** Graphical representation of media **/ 
     184                public function get display():DisplayObject { 
     185                        return _media; 
     186                } 
     187                 
     188                 
     189                /** Name of the MediaProvider. */ 
     190                public function get provider():String { 
     191                        return _provider; 
     192                } 
     193                 
     194                 
     195                /** 
     196                 * Current state of the MediaProvider. 
     197                 * @see PlayerStates 
     198                 */ 
     199                public function get state():String { 
     200                        return _state; 
     201                } 
     202                 
     203                 
     204                /** Currently playing PlaylistItem **/ 
     205                public function get item():PlaylistItem { 
     206                        return _item; 
     207                } 
     208                 
     209                 
     210                /** Current position, in seconds **/ 
     211                public function get position():Number { 
     212                        return _position; 
     213                } 
     214                 
     215                 
     216                /** 
     217                 * The current volume of the playing media 
     218                 * <p>Range: 0-100</p> 
     219                 */ 
     220                public function get volume():Number { 
     221                        return _volume; 
     222                } 
     223                 
     224                 
     225                /** Puts the video into a buffer state **/ 
     226                protected function buffer():void { 
     227                         
     228                } 
     229                 
     230                 
     231                /** Completes video playback **/ 
     232                protected function complete():void { 
     233                        stop(); 
     234                        sendMediaEvent(MediaEvent.JWPLAYER_MEDIA_COMPLETE); 
     235                } 
     236                 
     237                 
     238                /** Dispatches error notifications **/ 
     239                protected function error(message:String):void { 
     240                        stop(); 
     241                        sendMediaEvent(MediaEvent.JWPLAYER_MEDIA_ERROR, {message: message}); 
     242                } 
     243                 
     244                 
    245245                /** 
    246246                 * Sets the current state to a new state and sends a PlayerStateEvent 
     
    254254                        } 
    255255                } 
    256  
    257  
     256                 
     257                 
    258258                /** 
    259259                 * Sends a MediaEvent, simultaneously setting a property 
     
    271271                        dispatchEvent(newEvent); 
    272272                } 
    273  
    274  
     273                 
     274                 
    275275                /** Dispatches buffer change notifications **/ 
    276276                protected function sendBufferEvent(bufferPercent:Number, offset:Number=0):void { 
     
    278278                                _bufferPercent = bufferPercent; 
    279279                                sendMediaEvent(MediaEvent.JWPLAYER_MEDIA_BUFFER, {'bufferPercent': _bufferPercent, 
    280                                                 'offset': offset, 'duration': _item.duration}); 
    281                         } 
    282                 } 
    283  
    284  
    285                 /** Dispatches error notifications **/ 
    286                 protected function error(message:String):void { 
    287                         stop(); 
    288                         sendMediaEvent(MediaEvent.JWPLAYER_MEDIA_ERROR, {message: message}); 
    289                 } 
    290  
    291  
     280                                        'offset': offset, 'duration': _item.duration}); 
     281                        } 
     282                } 
     283                 
     284                 
     285                /** 
     286                 * The current config 
     287                 */ 
     288                protected function get config():PlayerConfig { 
     289                        return _config; 
     290                } 
     291                 
     292                 
    292293                /** 
    293294                 * Gets a property from the player configuration 
     
    298299                        return _config.pluginConfig(provider)[property]; 
    299300                } 
    300  
    301  
    302                 ///////////////////////////////////////////              
    303                 /// IGlobalEventDispatcher implementation 
    304                 ///////////////////////////////////////////              
    305                 /** 
    306                  * @inheritDoc 
    307                  */ 
    308                 public function addGlobalListener(listener:Function):void { 
    309                         _dispatcher.addGlobalListener(listener); 
    310                 } 
    311  
    312  
    313                 /** 
    314                  * @inheritDoc 
    315                  */ 
    316                 public function removeGlobalListener(listener:Function):void { 
    317                         _dispatcher.removeGlobalListener(listener); 
    318                 } 
    319  
    320  
    321                 /** 
    322                  * @inheritDoc 
    323                  */ 
    324                 public override function dispatchEvent(event:Event):Boolean { 
    325                         _dispatcher.dispatchEvent(event); 
    326                         return super.dispatchEvent(event); 
    327                 } 
    328  
    329  
     301                 
     302                /** 
     303                 * Gets the graphical representation of the media. 
     304                 *  
     305                 */ 
     306                protected function get media():DisplayObject { 
     307                        return _media; 
     308                } 
     309                 
     310                 
     311                /** 
     312                 * Sets the graphical representation of the media. 
     313                 *  
     314                 */ 
    330315                protected function set media(m:DisplayObject):void { 
    331316                        if (m) { 
     
    340325                        } 
    341326                } 
    342  
    343  
    344                 protected function get media():DisplayObject { 
    345                         return _media; 
     327                 
     328                 
     329                ///////////////////////////////////////////              
     330                /// IGlobalEventDispatcher implementation 
     331                ///////////////////////////////////////////              
     332                /** 
     333                 * @inheritDoc 
     334                 */ 
     335                public function addGlobalListener(listener:Function):void { 
     336                        _dispatcher.addGlobalListener(listener); 
     337                } 
     338                 
     339                 
     340                /** 
     341                 * @inheritDoc 
     342                 */ 
     343                public function removeGlobalListener(listener:Function):void { 
     344                        _dispatcher.removeGlobalListener(listener); 
     345                } 
     346                 
     347                 
     348                /** 
     349                 * @inheritDoc 
     350                 */ 
     351                public override function dispatchEvent(event:Event):Boolean { 
     352                        _dispatcher.dispatchEvent(event); 
     353                        return super.dispatchEvent(event); 
    346354                } 
    347355        } 
  • trunk/fl5/src/com/longtailvideo/jwplayer/media/RTMPMediaProvider.as

    r765 r796  
    8080                        if (ext == '.mp3') { 
    8181                                return 'mp3:' + url.substr(0, url.length - 4); 
    82                         } else if (ext == '.mp4' || ext == '.mov' || ext == '.aac' || ext == '.m4a' || ext == '.f4v') { 
     82                        } else if (ext == '.mp4' || ext == '.mov' || ext == '.aac' || ext == '.m4a' || ext == '.f4v' || ext == '.m4v') { 
    8383                                return 'mp4:' + url; 
    8484                        } else if (ext == '.flv') { 
  • trunk/fl5/src/com/longtailvideo/jwplayer/player/PlayerVersion.as

    r781 r796  
    33         
    44        public class PlayerVersion { 
    5                 protected static var _version:String = "5.1.781"; 
     5                protected static var _version:String = "5.1.796"; 
    66                 
    77                public static function get version():String { 
  • trunk/fl5/yt.as

    r512 r796  
    22System.security.allowDomain('*'); 
    33System.security.allowInsecureDomain('*'); 
    4  
    54 
    65 
     
    1413_as3_to_as2.allowDomain('*'); 
    1514_as2_to_as3.allowDomain('*'); 
     15 
    1616var connection:String; 
    1717var loadInterval:Number; 
     
    2020var loaded:Number; 
    2121var position:Number; 
    22  
     22var GlobalSound = new Sound(ytPlayer); 
    2323 
    2424 
     
    3131                ytPlayer.addEventListener("onError", onPlayerError); 
    3232                ytPlayer.unMute(); 
     33                ytPlayer.setVolume(100); 
    3334        } 
    3435}; 
     
    3637        var btl = ytPlayer.getVideoBytesLoaded(); 
    3738        var ttl = ytPlayer.getVideoBytesTotal(); 
    38         var off =  ytPlayer.getVideoStartBytes(); 
     39        var off = ytPlayer.getVideoStartBytes(); 
    3940        if(ttl > 10 && btl != loaded) { 
    4041                loaded = btl; 
     
    8283_as3_to_as2.playVideo = function() { ytPlayer.playVideo(); }; 
    8384_as3_to_as2.stopVideo = function(){ ytPlayer.stopVideo(); clearInterval(byteInterval); }; 
    84 _as3_to_as2.loadVideoById = function(id,pos) { ytPlayer.loadVideoById(id,pos); }; 
     85_as3_to_as2.loadVideoById = function(id,pos) {ytPlayer.stopVideo(); ytPlayer.loadVideoById(id,pos); }; 
    8586_as3_to_as2.cueVideoById = function(id,pos) { ytPlayer.cueVideoById(id,pos); }; 
    86 _as3_to_as2.setVolume = function(vol) { ytPlayer.setVolume(vol); }; 
     87_as3_to_as2.setVolume = function(vol) { ytPlayer.setVolume(100); GlobalSound.setVolume(vol) }; 
    8788_as3_to_as2.seekTo = function(pos) { ytPlayer.seekTo(pos,true); }; 
    8889_as3_to_as2.setSize = function(wid,hei) { ytPlayer.setSize(wid,hei); }; 
Note: See TracChangeset for help on using the changeset viewer.