Changeset 211
- Timestamp:
- 05/09/09 20:14:50 (4 years ago)
- Files:
-
- 1 added
- 13 edited
-
plugins/hd/hd.swf (modified) (previous)
-
testing/index.html (modified) (4 diffs)
-
trunk/as3/com/jeroenwijering/parsers/ItunesParser.as (modified) (1 diff)
-
trunk/as3/com/jeroenwijering/parsers/JWParser.as (modified) (1 diff)
-
trunk/as3/com/jeroenwijering/parsers/MediaParser.as (modified) (1 diff)
-
trunk/as3/com/jeroenwijering/player/Controller.as (modified) (12 diffs)
-
trunk/as3/com/jeroenwijering/player/Model.as (modified) (1 diff)
-
trunk/as3/com/jeroenwijering/player/Player.as (modified) (5 diffs)
-
trunk/as3/com/jeroenwijering/player/View.as (modified) (2 diffs)
-
trunk/as3/com/jeroenwijering/plugins/Rightclick.as (modified) (6 diffs)
-
trunk/as3/com/jeroenwijering/plugins/Watermark.as (modified) (4 diffs)
-
trunk/as3/com/jeroenwijering/utils/Logger.as (added)
-
trunk/as3/player.swf (modified) (previous)
-
trunk/sdk/testing.html (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
testing/index.html
r210 r211 109 109 vrs['plugins'] = plg.substr(0,plg.length-1); 110 110 } 111 vrs['tracecall'] = 'arthropod';112 111 $('#preview').css('height',vrs['height']); 113 112 $('#preview').html('<div id="container"></div>'); … … 377 376 <label>height</label> 378 377 <input type="text" name="height" value="260" /> 378 <label>icons</label> 379 <input type="text" name="icons" /> 379 380 <label>lightcolor</label> 380 381 <input type="text" name="lightcolor" /> … … 395 396 <label>displayclick</label> 396 397 <input type="text" name="displayclick" /> 397 <label>icons</label>398 <input type="text" name="icons" />399 398 <label>item</label> 400 399 <input type="text" name="item" /> 400 <label>linktarget</label> 401 <input type="text" name="linktarget" /> 401 402 <label>logo</label> 402 403 <input type="text" name="logo" /> … … 417 418 </fieldset> 418 419 <fieldset id="miscellaneous"> 419 <label>abouttext</label>420 <input type="text" name="abouttext" />421 <label>aboutlink</label>422 <input type="text" name="aboutlink" />423 420 <label>config</label> 424 421 <input type="text" name="config" /> 422 <label>debug</label> 423 <input type="text" name="debug" /> 425 424 <label>id</label> 426 425 <input type="text" name="id" /> 427 <label>linktarget</label>428 <input type="text" name="linktarget" />429 426 </fieldset> 430 427 <span id="fieldsetspan"></span> -
trunk/as3/com/jeroenwijering/parsers/ItunesParser.as
r169 r211 12 12 13 13 /** Prefix for the iTunes namespace. **/ 14 private static varPREFIX = 'itunes';14 private static const PREFIX = 'itunes'; 15 15 16 16 -
trunk/as3/com/jeroenwijering/parsers/JWParser.as
r161 r211 12 12 13 13 /** Prefix for the JW Player namespace. **/ 14 private static varPREFIX = 'jwplayer';14 private static const PREFIX = 'jwplayer'; 15 15 16 16 -
trunk/as3/com/jeroenwijering/parsers/MediaParser.as
r190 r211 12 12 13 13 /** Prefix for the JW Player namespace. **/ 14 private static varPREFIX = 'media';14 private static const PREFIX = 'media'; 15 15 16 16 -
trunk/as3/com/jeroenwijering/player/Controller.as
r210 r211 109 109 /** Catch errors dispatched by the playlister. **/ 110 110 private function errorHandler(evt:ErrorEvent):void { 111 dispatchEvent(new ControllerEvent(ControllerEvent.ERROR,{message:evt.text}));111 sendEvent(ControllerEvent.ERROR,{message:evt.text}); 112 112 }; 113 113 … … 230 230 var fmt:String = dat.localName().toLowerCase(); 231 231 } catch (err:Error) { 232 dispatchEvent(new ControllerEvent(ControllerEvent.ERROR,{message:'This playlist is not a valid XML file.'}));232 sendEvent(ControllerEvent.ERROR,{message:'This playlist is not a valid XML file.'}); 233 233 return; 234 234 } … … 250 250 break; 251 251 default: 252 dispatchEvent(new ControllerEvent(ControllerEvent.ERROR,{message:'Unknown playlist format: '+fmt}));252 sendEvent(ControllerEvent.ERROR,{message:'Unknown playlist format: '+fmt}); 253 253 return; 254 254 } … … 280 280 } 281 281 Configger.saveCookie('mute',config['mute']); 282 dispatchEvent(new ControllerEvent(ControllerEvent.MUTE,{state:config['mute']}));282 sendEvent(ControllerEvent.MUTE,{state:config['mute']}); 283 283 }; 284 284 … … 300 300 if(playlist) { 301 301 if(evt.data.state != false && config['state'] == ModelStates.PAUSED) { 302 dispatchEvent(new ControllerEvent(ControllerEvent.PLAY,{state:true}));302 sendEvent(ControllerEvent.PLAY,{state:true}); 303 303 } else if (evt.data.state != false && config['state'] == ModelStates.COMPLETED) { 304 dispatchEvent(new ControllerEvent(ControllerEvent.SEEK,{position:0}));304 sendEvent(ControllerEvent.SEEK,{position:0}); 305 305 } else if(evt.data.state != false && config['state'] == ModelStates.IDLE) { 306 306 playItem(); 307 307 } else if (evt.data.state != true && 308 308 (config['state'] == ModelStates.PLAYING || config['state'] == ModelStates.BUFFERING)) { 309 dispatchEvent(new ControllerEvent(ControllerEvent.PLAY,{state:false}));309 sendEvent(ControllerEvent.PLAY,{state:false}); 310 310 } 311 311 } … … 318 318 config['item'] = nbr; 319 319 } 320 dispatchEvent(new ControllerEvent(ControllerEvent.ITEM,{index:config['item']}));320 sendEvent(ControllerEvent.ITEM,{index:config['item']}); 321 321 }; 322 322 … … 336 336 playlist = ply; 337 337 } else { 338 dispatchEvent(new ControllerEvent(ControllerEvent.ERROR,{message:'No valid filetypes found in this playlist'}));338 sendEvent(ControllerEvent.ERROR,{message:'No valid filetypes found in this playlist'}); 339 339 return; 340 340 } … … 345 345 config['item'] = playlist.length-1; 346 346 } 347 dispatchEvent(new ControllerEvent(ControllerEvent.PLAYLIST,{playlist:playlist}));347 sendEvent(ControllerEvent.PLAYLIST,{playlist:playlist}); 348 348 if(config['autostart'] == true) { 349 349 playItem(); … … 378 378 sploader.layoutNormal(); 379 379 } 380 dispatchEvent(new ControllerEvent(ControllerEvent.RESIZE,{381 fullscreen:config['fullscreen'],width:config['width'],height:config['height']}) );380 sendEvent(ControllerEvent.RESIZE,{ 381 fullscreen:config['fullscreen'],width:config['width'],height:config['height']}); 382 382 }; 383 383 … … 389 389 if(pos < 1) { 390 390 pos = 0; 391 } else if (pos > playlist[config['item']]['duration']-1) { 391 } else if (pos > playlist[config['item']]['duration']-1) { 392 392 pos = playlist[config['item']]['duration']-1; 393 393 } 394 dispatchEvent(new ControllerEvent(ControllerEvent.SEEK,{position:pos})); 395 } 394 sendEvent(ControllerEvent.SEEK,{position:pos}); 395 } 396 }; 397 398 399 /** Log and dispatch events. **/ 400 private function sendEvent(typ:String,dat:Object=undefined):void { 401 Logger.log(dat,typ); 402 dispatchEvent(new ControllerEvent(typ,dat)); 396 403 }; 397 404 … … 399 406 /** Stop all playback and buffering. **/ 400 407 private function stopHandler(evt:ViewEvent=undefined):void { 401 dispatchEvent(new ControllerEvent(ControllerEvent.STOP));408 sendEvent(ControllerEvent.STOP); 402 409 }; 403 410 … … 439 446 config['volume'] = vol; 440 447 Configger.saveCookie('volume',config['volume']); 441 dispatchEvent(new ControllerEvent(ControllerEvent.VOLUME,{percentage:vol}));448 sendEvent(ControllerEvent.VOLUME,{percentage:vol}); 442 449 } 443 450 }; -
trunk/as3/com/jeroenwijering/player/Model.as
r210 r211 195 195 break; 196 196 } 197 dispatchEvent(new ModelEvent(typ,dat));198 } else {199 dispatchEvent(new ModelEvent(typ,dat));200 if(dat.width) { resizeHandler(); }201 }197 } else if(dat.width) { 198 resizeHandler(); 199 } 200 Logger.log(dat,typ); 201 dispatchEvent(new ModelEvent(typ,dat)); 202 202 }; 203 203 -
trunk/as3/com/jeroenwijering/player/Player.as
r210 r211 9 9 import com.jeroenwijering.plugins.*; 10 10 import com.jeroenwijering.utils.Configger; 11 import com.jeroenwijering.utils.Logger; 11 12 12 13 import flash.display.MovieClip; … … 40 41 dock:true, 41 42 height:300, 43 icons:true, 42 44 playlist:'none', 43 45 playlistsize:180, … … 49 51 displayclick:'play', 50 52 fullscreen:false, 51 icons:true,52 53 item:0, 54 linktarget:'_blank', 53 55 logo:undefined, 54 56 mute:false, … … 61 63 volume:90, 62 64 63 abouttext: undefined,65 abouttext:"JW Player", 64 66 aboutlink:"http://www.longtailvideo.com/players/jw-flv-player/", 65 67 client:undefined, 68 debug:'none', 66 69 id:undefined, 67 linktarget:'_blank', 68 token:undefined, 69 tracecall:undefined, 70 version:'4.5.208' 70 plugins:undefined, 71 version:'4.5.211' 71 72 }; 72 73 /** Reference to all stage graphics. **/ … … 110 111 /** When config is loaded, the player laods the skin. **/ 111 112 protected function loadSkin(evt:Event=null):void { 113 Logger.output = config['debug']; 112 114 sploader = new SPLoader(this); 113 115 sploader.addEventListener(SPLoaderEvent.SKIN,loadMVC); -
trunk/as3/com/jeroenwijering/player/View.as
r190 r211 94 94 if(prm.length > 0) { 95 95 prm = '('+prm.substr(0,prm.length-1)+')'; 96 }97 if(config['tracecall'] == 'arthropod') {98 var obj:Object = {CONTROLLER:'0xFF6666',VIEW:'0x66FF66',MODEL:'0x6666FF'};99 Debug.log(typ+' '+prm,obj[tgt]);100 } else if(config['tracecall'] == 'flash') {101 trace(tgt+': '+typ+' '+prm);102 } else if (config['tracecall'] && ready) {103 ExternalInterface.call(config['tracecall'],tgt+': '+typ+' '+prm);104 96 } 105 97 if(!dat) { dat = new Object(); } … … 286 278 break; 287 279 } 280 Logger.log(prm,typ); 288 281 dispatchEvent(new ViewEvent(typ,dat)); 289 282 }; -
trunk/as3/com/jeroenwijering/plugins/Rightclick.as
r170 r211 6 6 7 7 import com.jeroenwijering.events.*; 8 import com.jeroenwijering.utils.Logger; 9 import com.jeroenwijering.utils.Stretcher; 8 10 9 11 import flash.events.ContextMenuEvent; 10 12 import flash.net.URLRequest; 11 13 import flash.net.navigateToURL; 14 import flash.system.Capabilities; 12 15 import flash.ui.ContextMenu; 13 16 import flash.ui.ContextMenuItem; … … 27 30 /** Reference to the stretchmode menuitem. **/ 28 31 private var stretching:ContextMenuItem; 32 /** Reference to the debugging menuitem. **/ 33 private var debug:ContextMenuItem; 29 34 /** Reference to the MVC view. **/ 30 35 private var view:AbstractView; … … 38 43 39 44 40 /** 41 * Add an item to the contextmenu. 42 * 43 * @param itm An initialized ContextMenuItem 44 * @param fcn The function to call when the menuitem is clicked. 45 **/ 46 public function addItem(itm:ContextMenuItem,fcn:Function):void { 45 /** Add an item to the contextmenu. **/ 46 private function addItem(itm:ContextMenuItem,fcn:Function):void { 47 47 itm.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT,fcn); 48 48 itm.separatorBefore = true; … … 55 55 view = vie; 56 56 view.skin.contextMenu = context; 57 // Add the 'fullscreen' menuitem. 57 58 try { 58 if(view.skin.stage['displayState']) { 59 fullscreen = new ContextMenuItem('Toggle fullscreen...'); 60 addItem(fullscreen,fullscreenHandler); 61 } 59 fullscreen = new ContextMenuItem('Toggle Fullscreen...'); 60 addItem(fullscreen,fullscreenHandler); 62 61 } catch (err:Error) {} 62 // Add the 'stretching' menuitem. 63 63 stretching = new ContextMenuItem('Stretching is '+view.config['stretching']+'...'); 64 64 addItem(stretching,stretchHandler); 65 if(view.config['abouttext']) { 66 about = new ContextMenuItem(view.config['abouttext']+'...'); 65 // Add the 'about' menuitem. 66 if(view.config['abouttext'] == 'JW Player' || view.config['abouttext'] == undefined) { 67 about = new ContextMenuItem('About JW Player '+view.config['version']+'...'); 67 68 } else { 68 about = new ContextMenuItem('About JW Player '+view.config['version']+'...');69 about = new ContextMenuItem('About '+view.config['abouttext']+'...'); 69 70 } 70 71 addItem(about,aboutHandler); 72 // Add the 'debug' menuitem. 73 if(Capabilities.isDebugger == true || view.config['debug'] != 'none') { 74 debug = new ContextMenuItem('Logging to '+Logger.output+'...'); 75 addItem(debug,debugHandler); 76 } 71 77 }; 72 78 … … 78 84 79 85 86 /** change the debug system. **/ 87 private function debugHandler(evt:ContextMenuEvent):void { 88 var arr:Array = new Array(Logger.NONE,Logger.ARTHROPOD,Logger.CONSOLE,Logger.TRACE); 89 var idx:Number = arr.indexOf(Logger.output); 90 idx == arr.length-1 ? idx = 0: idx++; 91 debug.caption = 'Logging to '+arr[idx]+'...'; 92 Logger.output = arr[idx]; 93 }; 94 95 80 96 /** Toggle the fullscreen mode. **/ 81 private function fullscreenHandler(evt:ContextMenuEvent):void { 97 private function fullscreenHandler(evt:ContextMenuEvent):void { 82 98 view.sendEvent(ViewEvent.FULLSCREEN); 83 99 }; … … 86 102 /** Change the stretchmode. **/ 87 103 private function stretchHandler(evt:ContextMenuEvent):void { 88 var arr:Array = new Array('uniform','fill','exactfit','none'); 89 for (var idx:Number = 0; idx<arr.length; idx++) { 90 if(arr[idx] == view.config['stretching']) { 91 break; 92 } 93 } 104 var arr:Array = new Array(Stretcher.UNIFORM,Stretcher.FILL,Stretcher.EXACTFIT,Stretcher.NONE); 105 var idx:Number = arr.indexOf(view.config['stretching']); 94 106 idx == arr.length-1 ? idx = 0: idx++; 95 107 view.config['stretching'] = arr[idx]; 96 stretching.caption = 'Stretching is '+ view.config['stretching']+'...';108 stretching.caption = 'Stretching is '+arr[idx]+'...'; 97 109 view.sendEvent(ViewEvent.REDRAW); 98 110 }; -
trunk/as3/com/jeroenwijering/plugins/Watermark.as
r189 r211 1 1 /** 2 * Plugin that shows a watermark when buffering §.2 * Plugin that shows a watermark when buffering. 3 3 **/ 4 4 package com.jeroenwijering.plugins { … … 33 33 out: 0.5 34 34 }; 35 /** URL to redirect to on mouse click **/36 private var clickURL:String = "http://www.longtailvideo.com/players/jw-flv-player/";37 35 /** Set to true when the watermark is visible **/ 38 36 private var showing:Boolean = false; … … 72 70 private function resizeHandler(evt:ControllerEvent):void { 73 71 config = view.getPluginConfig(this); 74 this.x = config['x'] + 10;75 this.y = config['height'] - this.height - 12;72 x = config['x'] + 10; 73 y = config['height'] - height - 12; 76 74 }; 77 75 … … 110 108 /** Handle Mouse Click **/ 111 109 private function clickHandler(evt:MouseEvent):void { 112 navigateToURL(new URLRequest(clickURL),"_self"); 110 view.sendEvent(ViewEvent.PLAY,false); 111 navigateToURL(new URLRequest(view.config['aboutlink'])); 113 112 }; 114 113 -
trunk/sdk/testing.html
r184 r211 142 142 sendEvent: function(evt) { 143 143 evt.preventDefault(); 144 player.sendEvent($('#sendevent').val(),$('#sendeventdata').val()); 144 var typ = $('#sendevent').val(); 145 var dat = $('#sendeventdata').val(); 146 if(typ == 'LOAD' && dat.indexOf(':') > 0) { 147 var arr = new Array(); 148 var ply = dat.split(';'); 149 for(var i=0; i<ply.length; i++) { 150 var obj = new Object(); 151 var itm = ply[i].split(','); 152 for(var j=0; j<itm.length; j++) { 153 obj[itm[j].split(':')[0]] = itm[j].split(':')[1]; 154 } 155 arr.push(obj); 156 } 157 if(arr.length > 1) { 158 dat = arr; 159 } else { 160 dat = obj; 161 } 162 } 163 player.sendEvent(typ,dat); 145 164 }, 146 165 /** Set a listener to the player. **/ … … 235 254 <label>Event</label> 236 255 <select type="text" id="sendevent"> 256 <option>ITEM</option> 237 257 <option>LINK</option> 238 258 <option>LOAD</option> 239 259 <option>MUTE</option> 240 260 <option>NEXT</option> 241 <option>ITEM</option>242 261 <option>PLAY</option> 243 262 <option>PREV</option> … … 287 306 288 307 <div id="preview"> 289 <a href="readme.html">Learn how to use this testing page</a></div> 308 <p>Testing is simple: choose an example, change the flashvars and see if it works.<br/> 309 You can also download this testing page as part of the <a href="http://developer.longtailvideo.com/trac/changeset/HEAD/trunk/sdk?old_path=/&format=zip">plugin development SDK</a>.</p> 290 310 </div> 291 311 … … 350 370 <label>controlbar</label> 351 371 <input type="text" name="controlbar" /> 372 <label>dock</label> 373 <input type="text" name="dock" /> 352 374 <label>frontcolor</label> 353 375 <input type="text" name="frontcolor" /> 354 376 <label>height</label> 355 377 <input type="text" name="height" value="260" /> 378 <label>icons</label> 379 <input type="text" name="icons" /> 356 380 <label>lightcolor</label> 357 381 <input type="text" name="lightcolor" /> … … 372 396 <label>displayclick</label> 373 397 <input type="text" name="displayclick" /> 374 <label>icons</label>375 <input type="text" name="icons" />376 398 <label>item</label> 377 399 <input type="text" name="item" /> 400 <label>linktarget</label> 401 <input type="text" name="linktarget" /> 378 402 <label>logo</label> 379 403 <input type="text" name="logo" /> 380 404 <label>mute</label> 381 405 <input type="text" name="mute" /> 382 <label>replace</label>383 <input type="text" name="replace" />384 406 <label>repeat</label> 385 407 <input type="text" name="repeat" /> 386 408 <label>resizing</label> 387 409 <input type="text" name="resizing" /> 388 <label>respectduration</label>389 <input type="text" name="respectduration" />390 410 <label>shuffle</label> 391 411 <input type="text" name="shuffle" /> … … 398 418 </fieldset> 399 419 <fieldset id="miscellaneous"> 400 <label>abouttext</label>401 <input type="text" name="abouttext" />402 <label>aboutlink</label>403 <input type="text" name="aboutlink" />404 420 <label>config</label> 405 421 <input type="text" name="config" /> 422 <label>debug</label> 423 <input type="text" name="debug" /> 406 424 <label>id</label> 407 425 <input type="text" name="id" /> 408 <label>linktarget</label>409 <input type="text" name="linktarget" />410 426 </fieldset> 411 427 <span id="fieldsetspan"></span>
Note: See TracChangeset
for help on using the changeset viewer.
