Monday, April 27, 2009

[jQuery] Re: detect quicktime?

Jack,

I've used the following code in the past and found it to work - it is from
http://www.dithered.com/javascript/quicktime_detect/index.html where you can
check out documentation, use cases, and download it (along with a
redirection script if you need one). It is quite old, but should work. I
used it once as a basis for a port of flashObject
(http://blog.deconcept.com/flashobject/) to do the same for Quicktime, but
unfortunately I can't find what I did any more...

// Quicktime Detection v1.0
// documentation:
http://www.dithered.com/javascript/quicktime_detect/index.html
// license: http://creativecommons.org/licenses/by/1.0/
// code by Chris Nott (chris[at]dithered[dot]com)


var quicktimeVersion = 0;
function getQuicktimeVersion() {
var agent = navigator.userAgent.toLowerCase();

// NS3+, Opera3+, IE5+ Mac (support plugin array): check for Quicktime
plugin in plugin array
if (navigator.plugins != null && navigator.plugins.length > 0) {
for (i=0; i < navigator.plugins.length; i++ ) {
var plugin =navigator.plugins[i];
if (plugin.name.indexOf("QuickTime") > -1) {
quicktimeVersion = parseFloat(plugin.name.substring(18));
}
}
}

// IE4+ Win32: attempt to create an ActiveX object using VBScript
else if (agent.indexOf("msie") != -1 && parseInt(navigator.appVersion) >= 4
&& agent.indexOf("win")!=-1 && agent.indexOf("16bit")==-1) {
document.write('<scr' + 'ipt language="VBScript"\> \n');
document.write('on error resume next \n');
document.write('dim obQuicktime \n');
document.write('set obQuicktime =
CreateObject("QuickTimeCheckObject.QuickTimeCheck.1") \n');
document.write('if IsObject(obQuicktime) then \n');
document.write(' if obQuicktime.IsQuickTimeAvailable(0) then \n');
document.write(' quicktimeVersion =
CInt(Hex(obQuicktime.QuickTimeVersion) / 1000000) \n');
document.write(' end if \n');
document.write('end if \n');
document.write('</scr' + 'ipt\> \n');
}

// Can't detect in all other cases
else {
quicktimeVersion = quicktimeVersion_DONTKNOW;
}

return quicktimeVersion;
}

quicktimeVersion_DONTKNOW = -1;


Jack Killpatrick wrote:
>
>
> Hi All,
>
> I'm looking for a jquery plugin (or vanilla method) for detecting
> quicktime, so I can decide whether to embed a QT movie or not. Did some
> googling, but most of the methods seems really old and I didn't see any
> jQuery plugins dedicated to detection.
>
> Any links/advice?
>
> Thanks!
>
> - Jack
>
>
>

--
View this message in context: http://www.nabble.com/detect-quicktime--tp23248106s27240p23251745.html
Sent from the jQuery General Discussion mailing list archive at Nabble.com.

No comments: