Changeset 1228
- Timestamp:
- 08/20/10 19:32:44 (3 years ago)
- Location:
- trunk/fl5
- Files:
-
- 9 edited
-
player.swf (modified) (previous)
-
src/com/longtailvideo/jwplayer/controller/Controller.as (modified) (3 diffs)
-
src/com/longtailvideo/jwplayer/events/PlayerEvent.as (modified) (4 diffs)
-
src/com/longtailvideo/jwplayer/events/ViewEvent.as (modified) (11 diffs)
-
src/com/longtailvideo/jwplayer/player/JavascriptAPI.as (modified) (11 diffs)
-
src/com/longtailvideo/jwplayer/player/Player.as (modified) (4 diffs)
-
src/com/longtailvideo/jwplayer/player/PlayerVersion.as (modified) (1 diff)
-
src/com/longtailvideo/jwplayer/utils/JavascriptSerialization.as (modified) (1 diff)
-
src/com/longtailvideo/jwplayer/view/View.as (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/fl5/src/com/longtailvideo/jwplayer/controller/Controller.as
r1207 r1228 36 36 */ 37 37 [Event(name="jwplayerError", type = "com.longtailvideo.jwplayer.events.PlayerEvent")] 38 39 /** 40 * Sent when the player has been locked 41 * 42 * @eventType com.longtailvideo.jwplayer.events.PlayerEvent.JWPLAYER_LOCKED 43 */ 44 [Event(name="jwplayerLocked", type = "com.longtailvideo.jwplayer.events.PlayerEvent")] 45 46 /** 47 * Sent when the player has been unlocked 48 * 49 * @eventType com.longtailvideo.jwplayer.events.PlayerEvent.JWPLAYER_UNLOCKED 50 */ 51 [Event(name="jwplayerUnlocked", type = "com.longtailvideo.jwplayer.events.PlayerEvent")] 52 53 /** 54 * Sent when the player has gone into or out of fullscreen mode 55 * 56 * @eventType com.longtailvideo.jwplayer.events.PlayerEvent.JWPLAYER_FULLSCREEN 57 */ 58 [Event(name="jwplayerFullscreen", type = "com.longtailvideo.jwplayer.events.PlayerEvent")] 38 59 39 60 /** … … 283 304 if (!locking && (_lockingResume || _unlockAutostart)) { 284 305 _lockingResume = false; 306 if (_unlockAndLoad) { 307 load(_player.playlist.currentItem); 308 _unlockAndLoad = false; 309 } 285 310 play(); 286 311 if (_unlockAutostart) { 287 312 _unlockAutostart = false; 288 } else if (_unlockAndLoad) {289 _unlockAndLoad = false;290 313 } 291 314 } … … 626 649 _model.fullscreen = mode; 627 650 _view.fullscreen(mode); 651 dispatchEvent(new PlayerEvent(PlayerEvent.JWPLAYER_FULLSCREEN, mode.toString())); 628 652 return true; 629 653 } -
trunk/fl5/src/com/longtailvideo/jwplayer/events/PlayerEvent.as
r843 r1228 42 42 * <tr><td><code>client</code></td><td>A string representing the client the player runs in (e.g. FLASH WIN 9,0,115,0).</td></tr> 43 43 * <tr><td><code>version</code></td><td>A string representing the major version, minor version and revision number of the player (e.g. 5.0.395).</td></tr> 44 * <tr><td><code>message</code></td><td>Message explaining the cause of the error</td></tr>45 44 * </table> 46 45 * … … 60 59 * <tr><td><code>client</code></td><td>A string representing the client the player runs in (e.g. FLASH WIN 9,0,115,0).</td></tr> 61 60 * <tr><td><code>version</code></td><td>A string representing the major version, minor version and revision number of the player (e.g. 5.0.395).</td></tr> 62 * <tr><td><code>message</code></td><td>Message explaining the cause of the error</td></tr>63 61 * </table> 64 62 * … … 78 76 * <tr><td><code>client</code></td><td>A string representing the client the player runs in (e.g. FLASH WIN 9,0,115,0).</td></tr> 79 77 * <tr><td><code>version</code></td><td>A string representing the major version, minor version and revision number of the player (e.g. 5.0.395).</td></tr> 80 * <tr><td><code>message</code></td><td>Message explaining the cause of the error</td></tr>81 78 * </table> 82 79 * … … 85 82 */ 86 83 public static var JWPLAYER_ERROR:String = "jwplayerError"; 87 84 85 /** 86 * The PlayerEvent.JWPLAYER_FULLSCREEN constant defines the value of the 87 * <code>type</code> property of the event object 88 * for a <code>jwplayerFullscreen</code> event. 89 * 90 * <table class="innertable"> 91 * <tr><th>Property</th><th>Value</th></tr> 92 * <tr><td><code>id</code></td><td>ID of the player in the HTML DOM. Used by javascript to reference the player.</td></tr> 93 * <tr><td><code>client</code></td><td>A string representing the client the player runs in (e.g. FLASH WIN 9,0,115,0).</td></tr> 94 * <tr><td><code>version</code></td><td>A string representing the major version, minor version and revision number of the player (e.g. 5.0.395).</td></tr> 95 * <tr><td><code>message</code></td><td>New fullscreen mode ("true", or "false")</td></tr> 96 * </table> 97 * 98 * @see com.longtailvideo.jwplayer.player.Player 99 * @eventType jwplayerFullscreen 100 */ 101 public static var JWPLAYER_FULLSCREEN:String = "jwplayerFullscreen"; 102 88 103 public var id:String; 89 104 public var client:String; -
trunk/fl5/src/com/longtailvideo/jwplayer/events/ViewEvent.as
r419 r1228 5 5 6 6 /** 7 * The ViewEvent.JWPLAYER_RESIZE constant defines the value of the 8 * <code>type</code> property of the event object 9 * for a <code>jwplayerResize</code> event. 10 * 11 * @eventType jwplayerResize 12 */ 13 public static var JWPLAYER_RESIZE:String = "jwplayerResize"; 14 15 /** 7 16 * The ViewEvent.JWPLAYER_VIEW_PLAY constant defines the value of the 8 17 * <code>type</code> property of the event object 9 * for a <code>jwplayer Ready</code> event.18 * for a <code>jwplayerViewPlay</code> event. 10 19 * 11 20 * @eventType jwplayerViewPlay … … 16 25 * The ViewEvent.JWPLAYER_VIEW_PAUSE constant defines the value of the 17 26 * <code>type</code> property of the event object 18 * for a <code>jwplayer Ready</code> event.27 * for a <code>jwplayerViewPause</code> event. 19 28 * 20 29 * @eventType jwplayerViewPause … … 25 34 * The ViewEvent.JWPLAYER_VIEW_STOP constant defines the value of the 26 35 * <code>type</code> property of the event object 27 * for a <code>jwplayer Ready</code> event.36 * for a <code>jwplayerViewStop</code> event. 28 37 * 29 38 * @eventType jwplayerViewStop … … 34 43 * The ViewEvent.JWPLAYER_VIEW_NEXT constant defines the value of the 35 44 * <code>type</code> property of the event object 36 * for a <code>jwplayer Ready</code> event.45 * for a <code>jwplayerViewNext</code> event. 37 46 * 38 47 * @eventType jwplayerViewNext … … 43 52 * The ViewEvent.JWPLAYER_VIEW_PREV constant defines the value of the 44 53 * <code>type</code> property of the event object 45 * for a <code>jwplayer Ready</code> event.54 * for a <code>jwplayerViewPrev</code> event. 46 55 * 47 56 * @eventType jwplayerViewPrev … … 52 61 * The ViewEvent.JWPLAYER_VIEW_MUTE constant defines the value of the 53 62 * <code>type</code> property of the event object 54 * for a <code>jwplayer Ready</code> event.63 * for a <code>jwplayerViewMute</code> event. 55 64 * 56 65 * @eventType jwplayerViewMute … … 61 70 * The ViewEvent.JWPLAYER_VIEW_FULLSCREEN constant defines the value of the 62 71 * <code>type</code> property of the event object 63 * for a <code>jwplayer Ready</code> event.72 * for a <code>jwplayerViewFullscreen</code> event. 64 73 * 65 74 * @eventType jwplayerViewFullscreen … … 70 79 * The ViewEvent.JWPLAYER_VIEW_ITEM constant defines the value of the 71 80 * <code>type</code> property of the event object 72 * for a <code>jwplayer Ready</code> event.81 * for a <code>jwplayerViewItem</code> event. 73 82 * 74 83 * @eventType jwplayerViewItem … … 79 88 * The ViewEvent.JWPLAYER_VIEW_VOLUME constant defines the value of the 80 89 * <code>type</code> property of the event object 81 * for a <code>jwplayer Ready</code> event.90 * for a <code>jwplayerViewVolume</code> event. 82 91 * 83 92 * @eventType jwplayerViewVolume … … 88 97 * The ViewEvent.JWPLAYER_VIEW_LOAD constant defines the value of the 89 98 * <code>type</code> property of the event object 90 * for a <code>jwplayer Ready</code> event.99 * for a <code>jwplayerViewLoad</code> event. 91 100 * 92 101 * @eventType jwplayerViewLoad … … 97 106 * The ViewEvent.JWPLAYER_VIEW_REDRAW constant defines the value of the 98 107 * <code>type</code> property of the event object 99 * for a <code>jwplayer Ready</code> event.108 * for a <code>jwplayerViewRedraw</code> event. 100 109 * 101 110 * @eventType jwplayerViewRedraw 102 111 */ 103 112 public static var JWPLAYER_VIEW_REDRAW:String = "jwplayerViewRedraw"; 104 113 105 114 /** 106 115 * The ViewEvent.JWPLAYER_VIEW_SEEK constant defines the value of the 107 116 * <code>type</code> property of the event object 108 * for a <code>jwplayer Ready</code> event.117 * for a <code>jwplayerViewSeek</code> event. 109 118 * 110 119 * @eventType jwplayerViewSeek -
trunk/fl5/src/com/longtailvideo/jwplayer/player/JavascriptAPI.as
r1223 r1228 1 1 package com.longtailvideo.jwplayer.player { 2 import com.longtailvideo.jwplayer.events.GlobalEventDispatcher; 3 import com.longtailvideo.jwplayer.events.IGlobalEventDispatcher; 2 4 import com.longtailvideo.jwplayer.events.MediaEvent; 3 5 import com.longtailvideo.jwplayer.events.PlayerEvent; … … 22 24 23 25 protected var _listeners:Object; 24 26 protected var _queuedEvents:Array = []; 27 28 25 29 public function JavascriptAPI(player:IPlayer) { 26 30 _listeners = {}; … … 35 39 /** Delay the response to PlayerReady to allow the external interface to initialize in some browsers **/ 36 40 protected function playerReady(evt:PlayerEvent):void { 41 (_player as IGlobalEventDispatcher).addGlobalListener(queueEvents); 42 37 43 var timer:Timer = new Timer(50, 1); 44 38 45 timer.addEventListener(TimerEvent.TIMER_COMPLETE, function(timerEvent:TimerEvent):void { 39 46 var callbacks:String = _player.config.playerready ? _player.config.playerready + "," + "playerReady" : "playerReady"; … … 48 55 } catch (e:Error) {} 49 56 } 50 } 57 58 for each (var queuedEvent:PlayerEvent in _queuedEvents) { 59 listenerCallback(queuedEvent); 60 } 61 _queuedEvents = null; 62 63 } 64 65 (_player as IGlobalEventDispatcher).removeGlobalListener(queueEvents); 66 51 67 }); 52 68 timer.start(); 69 } 70 71 protected function queueEvents(evt:PlayerEvent):void { 72 _queuedEvents.push(evt); 53 73 } 54 74 … … 79 99 80 100 // Getters 81 ExternalInterface.addCallback("jwGetBandwidth", js_getBandwidth);82 101 ExternalInterface.addCallback("jwGetBuffer", js_getBuffer); 83 102 ExternalInterface.addCallback("jwGetDuration", js_getDuration); 84 103 ExternalInterface.addCallback("jwGetFullscreen", js_getFullscreen); 85 104 ExternalInterface.addCallback("jwGetHeight", js_getHeight); 86 ExternalInterface.addCallback("jwGetLevel", js_getLevel);87 ExternalInterface.addCallback("jwGetLockState", js_getLockState);88 105 ExternalInterface.addCallback("jwGetMute", js_getMute); 89 106 ExternalInterface.addCallback("jwGetPlaylist", js_getPlaylist); … … 105 122 ExternalInterface.addCallback("jwMute", js_mute); 106 123 ExternalInterface.addCallback("jwVolume", js_volume); 107 124 125 // UNIMPLEMENTED 126 //ExternalInterface.addCallback("jwGetBandwidth", js_getBandwidth); 127 //ExternalInterface.addCallback("jwGetLevel", js_getLevel); 128 //ExternalInterface.addCallback("jwGetLockState", js_getLockState); 108 129 109 130 } catch(e:Error) { … … 145 166 else if (evt is PlayerStateEvent) 146 167 args = listenerCallbackState(evt as PlayerStateEvent); 168 else if (evt is PlaylistEvent) 169 args = listenerCallbackPlaylist(evt as PlaylistEvent); 147 170 else if (evt is ViewEvent && (evt as ViewEvent).data != null) 148 args['data'] = (evt as ViewEvent).data; 171 args = {data: (evt as ViewEvent).data}; 172 else 173 args = {message: evt.message}; 149 174 150 175 var callbacks:Array = _listeners[evt.type] as Array; … … 177 202 if (evt.bufferPercent >= 0) returnObj.bufferPercent = evt.bufferPercent; 178 203 if (evt.duration >= 0) returnObj.duration = evt.duration; 179 if (evt.message != "") returnObj.message = evt.message; 204 if (evt.message) returnObj.message = evt.message; 205 // todo: strip out 'name.properties' named properties 180 206 if (evt.metadata != null) returnObj.metadata = evt.metadata; 181 if (evt.offset > = 0)returnObj.offset = evt.offset;207 if (evt.offset > 0) returnObj.offset = evt.offset; 182 208 if (evt.position >= 0) returnObj.position = evt.position; 183 209 … … 193 219 194 220 protected function listenerCallbackState(evt:PlayerStateEvent):Object { 195 if (evt.type == PlayerStateEvent.JWPLAYER_PLAYER_STATE) {221 if (evt.type == PlayerStateEvent.JWPLAYER_PLAYER_STATE) { 196 222 return { newstate: evt.newstate, oldstate: evt.oldstate }; 197 } else return {}; 198 } 199 223 } else return {}; 224 } 225 226 protected function listenerCallbackPlaylist(evt:PlaylistEvent):Object { 227 if (evt.type == PlaylistEvent.JWPLAYER_PLAYLIST_LOADED) { 228 return { playlist: JavascriptSerialization.playlistToArray(_player.playlist) }; 229 } else if (evt.type == PlaylistEvent.JWPLAYER_PLAYLIST_ITEM) { 230 return { index: _player.playlist.currentIndex }; 231 } else return {}; 232 } 233 200 234 /*********************************************** 201 235 ** GETTERS ** … … 211 245 212 246 protected function js_getDuration():Number { 213 return _player.playlist.currentItem .duration;247 return _player.playlist.currentItem ? _player.playlist.currentItem.duration : 0; 214 248 } 215 249 … … 223 257 224 258 protected function js_getLevel():Number { 225 return _player.playlist.currentItem .currentLevel;259 return _player.playlist.currentItem ? _player.playlist.currentItem.currentLevel : 0; 226 260 } 227 261 -
trunk/fl5/src/com/longtailvideo/jwplayer/player/Player.as
r1207 r1228 1 1 package com.longtailvideo.jwplayer.player { 2 2 import com.longtailvideo.jwplayer.controller.Controller; 3 import com.longtailvideo.jwplayer.events.GlobalEventDispatcher; 4 import com.longtailvideo.jwplayer.events.IGlobalEventDispatcher; 3 5 import com.longtailvideo.jwplayer.events.PlayerEvent; 4 6 import com.longtailvideo.jwplayer.model.IPlaylist; … … 30 32 * @author Pablo Schklowsky 31 33 */ 32 public class Player extends Sprite implements IPlayer {34 public class Player extends Sprite implements IPlayer, IGlobalEventDispatcher { 33 35 protected var model:Model; 34 36 protected var view:View; 35 37 protected var controller:Controller; 38 39 protected var _dispatcher:GlobalEventDispatcher; 36 40 37 41 /** Player constructor **/ … … 51 55 } 52 56 new RootReference(this); 57 _dispatcher = new GlobalEventDispatcher(); 53 58 model = newModel(); 54 59 view = newView(model); … … 295 300 } 296 301 302 303 /////////////////////////////////////////// 304 /// IGlobalEventDispatcher implementation 305 /////////////////////////////////////////// 306 /** 307 * @inheritDoc 308 */ 309 public function addGlobalListener(listener:Function):void { 310 _dispatcher.addGlobalListener(listener); 311 } 312 313 314 /** 315 * @inheritDoc 316 */ 317 public function removeGlobalListener(listener:Function):void { 318 _dispatcher.removeGlobalListener(listener); 319 } 320 321 322 /** 323 * @inheritDoc 324 */ 325 public override function dispatchEvent(event:Event):Boolean { 326 _dispatcher.dispatchEvent(event); 327 return super.dispatchEvent(event); 328 } 329 297 330 } 298 331 } -
trunk/fl5/src/com/longtailvideo/jwplayer/player/PlayerVersion.as
r1223 r1228 3 3 4 4 public class PlayerVersion { 5 protected static var _version:String = "5.3.122 3";5 protected static var _version:String = "5.3.1228"; 6 6 7 7 public static function get version():String { -
trunk/fl5/src/com/longtailvideo/jwplayer/utils/JavascriptSerialization.as
r1214 r1228 51 51 52 52 public static function stripDots(obj:Object):Object { 53 // Todo: create nested objects instead of removing the dots 54 53 55 var newObj:Object = (obj is Array) ? new Array() : new Object(); 54 56 for (var i:String in obj) { -
trunk/fl5/src/com/longtailvideo/jwplayer/view/View.as
r1149 r1228 272 272 dispatchEvent(new ViewEvent(ViewEvent.JWPLAYER_VIEW_FULLSCREEN, currentFSMode)); 273 273 } 274 274 dispatchEvent(new ViewEvent(ViewEvent.JWPLAYER_RESIZE, {width: RootReference.stage.stageWidth, height: RootReference.stage.stageHeight})); 275 275 276 redraw(); 276 277 }
Note: See TracChangeset
for help on using the changeset viewer.
