Changeset 976
- Timestamp:
- 04/30/10 07:32:41 (3 years ago)
- Location:
- trunk/html5/test
- Files:
-
- 2 edited
-
files/style.css (modified) (1 diff)
-
index.html (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/html5/test/files/style.css
r966 r976 9 9 color: #58C; 10 10 } 11 object , video{11 object { 12 12 display: block; 13 13 margin: 0 auto; -
trunk/html5/test/index.html
r966 r976 66 66 67 67 /** The complete list with all current flashvars. **/ 68 var variables = {width:500,height:260 };68 var variables = {width:500,height:260,skin:'five'}; 69 69 /** When jQuery is loaded, we initialize everything. **/ 70 $().ready(function() { 71 loadSettings(); 72 setAPI(); 73 }); 70 $().ready(function() { loadSettings(); }); 74 71 /** Load the settings and querystring. **/ 75 72 function loadSettings() { … … 89 86 variables[decodeURIComponent(arguments[1])] = decodeURIComponent(arguments[2]); 90 87 }); 88 // Set the handlers on the API calls 89 $("#variablesform").submit(function(evt) { getVariable(evt); }); 90 $("#sendeventform").submit(function(evt) { sendEvent(evt); }); 91 $("#listenersform").submit(function(evt) { setListener(evt); }); 91 92 // set the value and handler on player, skin and plugins. 92 93 if(variables['player']) { $('#players').val(variables['player']); } 93 94 $("#players").change(function(evt) { reloadFieldsets(evt); }); 94 95 if(variables['skin']) { $('#skins').val(variables['skin']); } 95 $("#skins").change(function(evt) { insertPlayer(evt); });96 $("#skins").change(function(evt) { reloadPage(evt); }); 96 97 //if(variables['plugins']) { $('#plugins').val(variables['plugins'].split(',')); } 97 98 $("#plugins").change(function(evt) { reloadFieldsets(evt); }); 98 99 // set the handler on the flashvars and load the whole bunch. 99 $("#flashvarsform").submit(function(evt) { insertPlayer(evt); });100 $("#flashvarsform").submit(function(evt) { reloadPage(evt); }); 100 101 reloadFieldsets(); 101 102 }; … … 214 215 215 216 /** Print the player on the page. **/ 216 function insertPlayer(evt) { 217 function insertPlayer() { 218 variables['skin'] = settings.skins[variables['skin']]; 219 var lnk = 'http://developer.longtailvideo.com/player/trunk/html5/test/'; 220 $("#permalink").val(lnk+'?'+$.param(variables)); 221 $('#container').attr('src',variables['file']); 222 $('#container').jwplayer(variables); 223 }; 224 /** Change the page URL. **/ 225 function reloadPage(evt) { 217 226 if(evt) { evt.preventDefault(); } 218 var vrs = {};219 227 variables = {} 220 228 if($("#skins").val() != 'none') { 221 vrs['skin'] = settings.skins[$("#skins").val()];222 229 variables['skin'] = $("#skins").val(); 223 }224 if($("#plugins").val() != null) {225 var plg = [];226 var arr = $("#plugins").val();227 for(var i=0; i<arr.length; i++) {228 plg.push(settings[settings.plugin_api+'_plugins'][arr[i]]);229 }230 vrs['plugins'] = plg.join(',');231 variables['plugins'] = arr.join(',');232 230 } 233 231 var arr = $("#flashvarsform").find('input'); 234 232 for(var i=0; i<arr.length; i++) { 235 233 if($(arr[i]).val()) { 236 vrs[$(arr[i]).attr('name')] = $(arr[i]).val();237 234 variables[$(arr[i]).attr('name')] = $(arr[i]).val(); 238 235 } 239 236 } 240 var ply = settings.players[$('#players').val()]; 241 $('#preview').html('<video id="container" src="'+vrs['file']+'" width="'+vrs['width']+'" height="'+vrs['height']+'">Your browser supports neither HTML5 nor Flash</video>'); 242 $('#container').jwplayer(vrs); 243 var lnk = 'http://developer.longtailvideo.com/player/trunk/html5/test/'; 244 $("#permalink").val(lnk+'?'+$.param(variables)); 237 window.top.location.href = window.top.location.pathname+'?'+$.param(variables); 245 238 }; 246 239 … … 252 245 **/ 253 246 254 /** When the player is ready and the API forms can be shown, display them. **/255 function setAPI(obj) {256 $("#variablesform").submit(function(evt) { getVariable(evt); });257 $("#sendeventform").submit(function(evt) { sendEvent(evt); });258 $("#listenersform").submit(function(evt) { setListener(evt); });259 };260 247 /** Get a variable from the player. **/ 261 248 function getVariable(evt) { … … 263 250 var typ = $('#vartype').val().toString(); 264 251 var prp = $.jwplayer()[typ](); 252 alert(prp); 265 253 }; 266 254 /** Send an event to the player. **/ … … 269 257 var typ = $('#sendevent').val(); 270 258 var pr1 = $('#sendeventdata1').val(); 259 if(pr1 == 'true') { pr1 = true } else if (pr1 == 'false') { pr1 = false; } 271 260 var pr2 = $('#sendeventdata2').val(); 272 261 if(pr2) { … … 329 318 <option>height</option> 330 319 <option>mute</option> 320 <option>position</option> 331 321 <option>state</option> 332 <option>time</option>333 322 <option>volume</option> 334 323 <option>width</option> … … 382 371 383 372 <div id="preview"> 384 <p>Testing is simple: choose an example, change the flashvars and see if it works.</p> 373 <video id="container" width="400" height="200"> 374 Your browser supports neither video nor flash. 375 </video> 385 376 </div> 386 377
Note: See TracChangeset
for help on using the changeset viewer.
