MCPcopy Create free account
hub / github.com/CreateJS/SoundJS / matchVersions

Function matchVersions

lib/flashaudioplugin-NEXT.js:258–313  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

256 /* Perform Flash Player and SWF version matching; static publishing only
257 */
258 function matchVersions() {
259 var rl = regObjArr.length;
260 if (rl > 0) {
261 for (var i = 0; i < rl; i++) { // for each registered object element
262 var id = regObjArr[i].id;
263 var cb = regObjArr[i].callbackFn;
264 var cbObj = {success:false, id:id};
265 if (ua.pv[0] > 0) {
266 var obj = getElementById(id);
267 if (obj) {
268 if (hasPlayerVersion(regObjArr[i].swfVersion) && !(ua.wk && ua.wk < 312)) { // Flash Player version >= published SWF version: Houston, we have a match!
269 setVisibility(id, true);
270 if (cb) {
271 cbObj.success = true;
272 cbObj.ref = getObjectById(id);
273 cb(cbObj);
274 }
275 }
276 else if (regObjArr[i].expressInstall && canExpressInstall()) { // show the Adobe Express Install dialog if set by the web page author and if supported
277 var att = {};
278 att.data = regObjArr[i].expressInstall;
279 att.width = obj.getAttribute("width") || "0";
280 att.height = obj.getAttribute("height") || "0";
281 if (obj.getAttribute("class")) { att.styleclass = obj.getAttribute("class"); }
282 if (obj.getAttribute("align")) { att.align = obj.getAttribute("align"); }
283 // parse HTML object param element's name-value pairs
284 var par = {};
285 var p = obj.getElementsByTagName("param");
286 var pl = p.length;
287 for (var j = 0; j < pl; j++) {
288 if (p[j].getAttribute("name").toLowerCase() != "movie") {
289 par[p[j].getAttribute("name")] = p[j].getAttribute("value");
290 }
291 }
292 showExpressInstall(att, par, id, cb);
293 }
294 else { // Flash Player and SWF version mismatch or an older Webkit engine that ignores the HTML object element's nested param elements: display alternative content instead of SWF
295 displayAltContent(obj);
296 if (cb) { cb(cbObj); }
297 }
298 }
299 }
300 else { // if no Flash Player is installed or the fp version cannot be detected we let the HTML object element do its job (either show a SWF or alternative content)
301 setVisibility(id, true);
302 if (cb) {
303 var o = getObjectById(id); // test whether there is an HTML object element or not
304 if (o && typeof o.SetVariable != UNDEF) {
305 cbObj.success = true;
306 cbObj.ref = o;
307 }
308 cb(cbObj);
309 }
310 }
311 }
312 }
313 }
314
315 function getObjectById(objectIdStr) {

Callers 2

mainFunction · 0.70
testPlayerVersionFunction · 0.70

Calls 7

getElementByIdFunction · 0.70
hasPlayerVersionFunction · 0.70
setVisibilityFunction · 0.70
getObjectByIdFunction · 0.70
canExpressInstallFunction · 0.70
showExpressInstallFunction · 0.70
displayAltContentFunction · 0.70

Tested by

no test coverage detected