/////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////// // /////// // Wasp /////// // Version 2.0 /////// // (Formerly known as: Wimpy AV Single Play) /////// // /////// // by Mike Gieson /////// // /////// // Available at http://www.wimpyplayer.com /////// // ©2002-2006 plaino /////// // /////// /////////////////////////////////////////////////////////////// // // This product includes software developed by Macromedia, Inc. // // Macromedia(r) Flash(r) JavaScript Integration Kit // Portions noted as part of the JavaScript Integration Kit // are Copyright (c) 2005 Macromedia, inc. All rights reserved. // http://www.macromedia.com/go/flashjavascript/ // // Macromedia(r) Flash(r) JavaScript Integration Kit Created by: // // Christian Cantrell // http://weblogs.macromedia.com/cantrell/ // mailto:cantrell@macromedia.com // // Mike Chambers // http://weblogs.macromedia.com/mesh/ // mailto:mesh@macromedia.com // // Macromedia // ///////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////// //////////// //////////// //////////// OPTIONS //////////// //////////// //////////// ///////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////// // // Set locations of files: // // waspSWFfilename // You can change the name of the wasp.swf file here. // Obviously, if you change the name here, then you will have to // change the name of the actual file in your wasp folder too. waspSWFfilename = "/video/player/wasp.swf"; // // Default Image: // // defaultImage // Allows you to set a default graphic if the player is does not // startOnLoad automatically. Also, if the player is not set to // loop, the image defined here will show up once the video is complete. // // The graphic will automatically be size to the same dimensions as the video window. // When the image is clicked the video current video (if defined) will start to play. // // Example: //defaultImage = "http://www/path/to/graphic.jpg"; defaultImage = "/binary/81ef/Picture-1.jpg"; // // waspHTMLtemplateFilename // This is the page that is used when a pop up window is called. // This file should be located in the wasp installation folder. // You can change the name of the waspTemplate.html file here. // Obviously, if you change the name here, then you will have to // change the name of the actual file in your wasp folder too. waspHTMLtemplateFilename = ""; // // startPlayingOnload // Setting this to "yes" will start to play automatically. // Setting this to "no" will force the user to click the // "play" button to start playing the video //startPlayingOnload = "no"; startPlayingOnload = "no"; // // transparentBkgd // This will anable you to "see through" the player and display // the HTML (or table) backgournd image or color. transparentBkgd = "yes"; // // bkgdColor // If not using a transparent background, this will be the // background color of the video window. bkgdColor = "#ffffff"; // // popUpHelp // Setting this to "yes" will display little yellow "help" // boxes when the user hoovers over the control functions. // Setting this to "no" will disable this feature. popUpHelp = "yes"; // // loopTrack // Setting thei to "yes" will cause the video to repeat // once it has reached the end, and continue to loop // until the user clicks stop. // Setting this to "no" will cause the video to // disappear once it has finished. loopTrack = "no"; // // theVolume // You can controll the initial volume setting when // the player loads. The range is 0-100, where 0 is // no sound and 100 is full volume theVolume = "100"; // // controllocation // You can place the playback controls above or below // the video. To place the controls above the video, // set this to "top" - to place the controls below the video, // set this to "bottom" //controllocation = "top"; controllocation = "bottom"; // // bufferSeconds // Causes the video to load for a certain number of seconds // before starting to play. A higher value can minimize the // "stutter" effect users might have with slower connections, // or larger files. bufferSeconds = 3; // // videoSmoothing // Specifies whether the video should be smoothed // (interpolated) when it is scaled. //videoSmoothing = "yes"; videoSmoothing = "no"; // // videoDeblocking // Setting this to "yes" can degrade overall playback performance // for less powerful PCs. Leave at "" to allow the end user's // system to manage the filter automatically. //videoDeblocking = "yes"; //videoDeblocking = "no"; videoDeblocking = ""; // // ///////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////// //////////// //////////// //////////// NO FURTHER CONFIGURATION NEEDED //////////// //////////// //////////// ///////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////// //////////// //////////// //////////// IN OTHER WORDS, DON'T EDIT //////////// //////////// ANYTHING BELOW HERE UNLESS //////////// //////////// YOU'RE FAMILIAR WITH JAVASCRIPT //////////// //////////// //////////// ///////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////// // function waspPopup (filename, width, height){ var rnum = (Math.round((Math.random()*1000000)+1)); var padControls = height+15 var theURL = waspHTMLtemplateFilename+'?theFile='+filename+'&wW='+width+'&wH='+padControls; var winName = 'wasp'+rnum; var extras = 'width='+width+',height='+padControls window.open(theURL,winName,extras); } function writeSWFcode(fileSWF, fileIN, theWidth, theHeight){ // myuid = new Date().getTime(); myuid = "wasp" + myuid flashProxy = new FlashProxy(myuid, waspSWFfilename); // var perpix = new String(theHeight); if(perpix.indexOf("%") > (-1)){ var padControls = theHeight; } else { var padControls = theHeight+15; } var queryString = ''; queryString += "theFile="+fileIN; // js2wasp_param = ''; js2wasp_embed = 'flashvars="lcId='+myuid+'" '; // if(transparentBkgd == "yes"){ var tptBkgd_param = ''; var tptBkgd_embed = 'wmode="transparent" '; } else { var tptBkgd_param = ""; var tptBkgd_embed = ""; } if(startPlayingOnload == "yes"){ queryString += '&startPlayingOnload='+startPlayingOnload; } if(popUpHelp == "no"){ queryString += '&popUpHelp='+popUpHelp; } if(loopTrack == "yes"){ queryString += '&loopTrack='+loopTrack; } if(controllocation == "top"){ queryString += '&controllocation='+controllocation; } if(theVolume != 100 && theVolume > 0 && theVolume < 100){ queryString += '&theVolume='+theVolume; } if(bufferSeconds > 3){ queryString += '&bufferSeconds='+bufferSeconds; } if(defaultImage != ""){ queryString += '&defaultImage='+defaultImage; } if(videoDeblocking == "yes" || videoDeblocking == "no"){ queryString += "&videoDeblocking="+videoDeblocking; } if(videoSmoothing == "yes"){ queryString += "&videoSmoothing="+videoSmoothing; } var flashCode = ''; var newlineChar = "\n"; flashCode += ''+newlineChar; flashCode += ''+newlineChar; flashCode += ''+newlineChar; flashCode += ''+newlineChar; flashCode += ''+newlineChar; flashCode += ''+newlineChar; flashCode += ''+newlineChar; flashCode += ''+newlineChar; flashCode += tptBkgd_param; flashCode += js2wasp_param; flashCode += ''+newlineChar; // To reveal the source HTML, uncomment below: //document.write('

')+newlineChar; document.write(flashCode); } function wasp(){ startPlayingOnload = "yes"; var qsParm = new Array(); var query = window.location.search.substring(1); var parms = query.split('&'); for (var i=0; i 0) { var key = parms[i].substring(0,pos); var val = parms[i].substring(pos+1); qsParm[key] = val; } } var fileSWFsend = waspSWFfilename; var fileINsend = qsParm['theFile']; writeSWFcode(fileSWFsend, fileINsend, "100%", "100%"); } function waspEmbed(theFileIN, theWidthIN, theHeightIN){ var fileSWFsend = waspSWFfilename; var fileINsend = theFileIN; writeSWFcode(fileSWFsend, fileINsend, theWidthIN, theHeightIN); } function wasp_loadAndPlay(theFileIN){ flashProxy.call('js_wasp_loadAndPlay', theFileIN); } /* The following code is part of the Flash / JavaScript Integration Kit: http://www.macromedia.com/go/flashjavascript/ */ function Exception(name, message){ if (name) this.name = name; if (message) this.message = message; } Exception.prototype.setName = function(name){ this.name = name; } Exception.prototype.getName = function(){ return this.name; } Exception.prototype.setMessage = function(msg){ this.message = msg; } Exception.prototype.getMessage = function(){ return this.message; } function FlashProxy(uid, proxySwfName){ this.uid = uid; this.proxySwfName = proxySwfName; this.flashSerializer = new FlashSerializer(false); } FlashProxy.prototype.call = function(){ if (arguments.length == 0) { throw new Exception("Flash Proxy Exception", "The first argument should be the function name followed by any number of additional arguments."); } var qs = 'lcId=' + escape(this.uid) + '&functionName=' + escape(arguments[0]); if (arguments.length > 1) { var justArgs = new Array(); for (var i = 1; i < arguments.length; ++i) { justArgs.push(arguments[i]); } qs += ('&' + this.flashSerializer.serialize(justArgs)); } var divName = '_flash_proxy_' + this.uid; if(!document.getElementById(divName)) { var newTarget = document.createElement("div"); newTarget.id = divName; document.body.appendChild(newTarget); } var target = document.getElementById(divName); var ft = new FlashTag(this.proxySwfName, 1, 1); ft.setVersion('6,0,65,0'); ft.setFlashvars(qs); target.innerHTML = ft.toString(); } FlashProxy.callJS = function(){ var functionToCall = eval(arguments[0]); var argArray = new Array(); for (var i = 1; i < arguments.length; ++i) { argArray.push(arguments[i]); } functionToCall.apply(functionToCall, argArray); } function FlashSerializer(useCdata){ this.useCdata = useCdata; } FlashSerializer.prototype.serialize = function(args){ var qs = new String(); for (var i = 0; i < args.length; ++i) { switch(typeof(args[i])) { case 'undefined': qs += 't'+(i)+'=undf'; break; case 'string': qs += 't'+(i)+'=str&d'+(i)+'='+escape(args[i]); break; case 'number': qs += 't'+(i)+'=num&d'+(i)+'='+escape(args[i]); break; case 'boolean': qs += 't'+(i)+'=bool&d'+(i)+'='+escape(args[i]); break; case 'object': if (args[i] == null) { qs += 't'+(i)+'=null'; } else if (args[i] instanceof Date) { qs += 't'+(i)+'=date&d'+(i)+'='+escape(args[i].getTime()); } else // array or object { try { qs += 't'+(i)+'=xser&d'+(i)+'='+escape(this._serializeXML(args[i])); } catch (exception) { throw new Exception("FlashSerializationException", "The following error occurred during complex object serialization: " + exception.getMessage()); } } break; default: throw new Exception("FlashSerializationException", "You can only serialize strings, numbers, booleans, dates, objects, arrays, nulls, and undefined."); } if (i != (args.length - 1)) { qs += '&'; } } return qs; } FlashSerializer.prototype._serializeXML = function(obj){ var doc = new Object(); doc.xml = ''; this._serializeNode(obj, doc, null); doc.xml += ''; return doc.xml; } FlashSerializer.prototype._serializeNode = function(obj, doc, name){ switch(typeof(obj)) { case 'undefined': doc.xml += ''; break; case 'string': doc.xml += ''+this._escapeXml(obj)+''; break; case 'number': doc.xml += ''+obj+''; break; case 'boolean': doc.xml += ''; break; case 'object': if (obj == null) { doc.xml += ''; } else if (obj instanceof Date) { doc.xml += ''+obj.getTime()+''; } else if (obj instanceof Array) { doc.xml += ''; for (var i = 0; i < obj.length; ++i) { this._serializeNode(obj[i], doc, null); } doc.xml += ''; } else { doc.xml += ''; for (var n in obj) { if (typeof(obj[n]) == 'function') continue; this._serializeNode(obj[n], doc, n); } doc.xml += ''; } break; default: throw new Exception("FlashSerializationException", "You can only serialize strings, numbers, booleans, objects, dates, arrays, nulls and undefined"); break; } } FlashSerializer.prototype._addName= function(name){ if (name != null) { return ' name="'+name+'"'; } return ''; } FlashSerializer.prototype._escapeXml = function(str){ if (this.useCdata) return ''; else return str.replace(/&/g,'&').replace(/'; flashTag += ''; flashTag += ''; flashTag += ''; if (this.flashVars != null) { flashTag += ''; } flashTag += ''; } else { flashTag += '