detect Flash / offer .mp3 ??

expatCanuck

New Member
Greetings.

I have song pages on my site (here, for example) that load the jwPlayer and play a recording.

They seem to work fine, unless Flash isn't installed, isn't the correct version, or isn't working properly.

What I'd like to do is be able to detect when Flash isn't present so that I can offer an .mp3 (as tho' clicking on a link).

(The alternative would be a 'click here if you can't hear the tune' link.)

So, if anyone can point me in the direction of Flash detection routines, that'd be splendid.

And what should I be using to do this -- Javascript? Actionscript? Something else?

Thanks kindly.

- Richard
 
Last edited:

Mteigers

New Member
This'll do it for you it will detect your flash version for you, make sure you have both index.html and AC_OETags.js in the same folder .. the first part sets the variables telling the script that if the user has anything less than version 8.0.0 of flash then it will fail (you can change that).. Currently its set so if you don't have flash or the wrong version it will give them a link to download flash but you could change that to something like:

Here is the first file AC_OETags.js (currently a .txt, save as a .js): http://support.veonstyles.com/uploads/AC_OETags.txt


Change:
// flash is too old or we can't detect the plugin
var alternateContent = 'Alternate HTML content should be placed here.<BR>'
+ 'This content requires the Adobe Flash Player. '
+ '<a href=http://www.adobe.com/go/getflash/>Get Flash</a>';
document.write(alternateContent); // insert non-flash content

To something like:
// flash is too old or we can't detect the plugin
var alternateContent = '<a href="link.mp3">Click here for mp3</a><br />'
+ 'More content, you could suggest them to go download -> '
+ '<a href=http://www.adobe.com/go/getflash/>Get Flash</a>';
document.write(alternateContent); // insert non-flash content


The bottom <noscript> isn't really needed that's more content that will show up if the user doesn't happen to have flash or has it disabled.


Here it is index.html:
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Client Detection Example</title>
<script src="AC_OETags.js" language="javascript"></script>
<script language="JavaScript" type="text/javascript">
<!--
// -----------------------------------------------------------------------------
// Globals
// Major version of Flash required
var requiredMajorVersion = 8;
// Minor version of Flash required
var requiredMinorVersion = 0;
// Minor version of Flash required
var requiredRevision = 0;
// -----------------------------------------------------------------------------
// -->
</script>
</head>

<body>
<script language="JavaScript" type="text/javascript">
<!--
// Version check based upon the values entered above in "Globals"
var hasReqestedVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);

// Check to see if the version meets the requirements for playback
if (hasReqestedVersion) {
// if we've detected an acceptable version
// embed the Flash Content SWF when all tests are passed
AC_FL_RunContent(
"src", "example",
"width", "550",
"height", "200",
"align", "middle",
"id", "detectionExample",
"quality", "high",
"bgcolor", "#FFFFFF",
"name", "detectionExample",
"allowScriptAccess","sameDomain",
"type", "application/x-shockwave-flash",
'codebase', 'http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab',
"pluginspage", "http://www.adobe.com/go/getflashplayer"
);
} else { // flash is too old or we can't detect the plugin
var alternateContent = 'Alternate HTML content should be placed here.<BR>'
+ 'This content requires the Adobe Flash Player. '
+ '<a href=http://www.adobe.com/go/getflash/>Get Flash</a>';
document.write(alternateContent); // insert non-flash content
}
// -->
</script>
<noscript>
Provide alternate content for browsers that do not support scripting
or for those that have scripting disabled.
Alternate HTML content should be placed here.
This content requires the Adobe Flash Player and a browser with JavaScript enabled.
<a href="http://www.adobe.com/go/getflash/">Get Flash</a>
</noscript>
</body>
</html>


Hope that helps :D
 
Top