Novemberborn, Straight lines circle sometime

Caught Redhanded: QuickTime Stealing Flash

Sometimes QuickTime may take over handling Flash content. As QuickTime is only compatible with Flash 5, this can pose major problems. Here’s some code which detects if QuickTime is handling Flash:

var qtFlash = false; // Is QuickTime rendering Flash?
var flashPlugin = navigator.plugins['Shockwave Flash'];
for(var i = 0; i < navigator.mimeTypes.length; i++) {
    var mime = navigator.mimeTypes[i];
    if(mime.type == 'application/x-shockwave-flash' 
    && mime.enabledPlugin != flashPlugin) {
        qtFlash = true;
        break;
    }
}

[Update April 28, 2006] If there are multiple Flash versions installed this test won’t work. Instead try this:

var qtFlash = false; // Is QuickTime rendering Flash?
var flashVersion = 7; // Stub for real detection code
for(var i = 0; i < navigator.mimeTypes.length; i++) {
    var mime = navigator.mimeTypes[i];
    if(mime.type == 'application/x-shockwave-flash' 
    && !new RegExp('.*Shockwave\\sFlash\\s' + flashVersion
    + '.*').exec(mime.enabledPlugin.description)) {
        qtFlash = true;
        break;
    }
}

If you want to test this see these Mozilla guidelines and apply them in reverse order.

This workaround doesn’t work in IE, though, which leaves me wondering how to detect QuickTime for that browser. Here’s the Flash detection code for IE in sIFR:

if(this.ieWin) {
  try {
    this.flashVersion = parseFloat(
                new ActiveXObject('ShockwaveFlash.ShockwaveFlash.7')
                .GetVariable('$version').match(/([\d,?]+)/)[1].replace(/,/g, '.')
            );
  } catch(e) {}
}

I haven’t been able to get IE to use QuickTime, so the question is: will IE be able to create a Shockwave Flash object if QuickTime is handling Flash? If not, problem solved. If so, any ideas on detecting QuickTime?

link | javascript | 8 February 2006, 18:18


Comments

Leave your comment

Please keep it polite and on topic. Yes, your e-mail address is required, but it's kept private. HTML is not allowed in the comments but you can use Markdown. Non-contributing comments run the risk of being removed. Especially if the website seem “fishy”. Spammers, beware.

(required)
(required, kept private)
(optional, but let's share it!)
(required)

Remember my details


Novemberborn: Extra

About the author

Mark Wubben is a hacker/writer in Enschede, the Netherlands.

Read more about Mark...

Go to

Jobs (NL)

Xopus zoekt programmeurs! Verbeter de code en win!

Subscribe