Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
A little code snippet to check if the current browser is enabled to use the Chromium built-in PPAPI (a.k.a. "Pepper") Flash Player, i.e. instead of the Adobe Flash Player (or some other player, e.g. Gnash, Klash, etc.).
// NOTE: Some code taken from this StackOverflow question:
// http://stackoverflow.com/questions/12866060/detecting-pepper-ppapi-flash-with-javascript
var isUsingPepperFlash = (function() {
var getFlashPlayerFileName = function(mimeTypes, type) {
return (
mimeTypes &&
mimeTypes[type] &&
mimeTypes[type].enabledPlugin &&
mimeTypes[type].enabledPlugin.filename
) || '';
};
return function() {
var isPPAPI = false;
var mimeTypes = window.navigator.mimeTypes;
var flashMimeType = "application/x-shockwave-flash";
var flashPlayerFileName = getFlashPlayerFileName(mimeTypes, flashMimeType).toLowerCase();
if (flashPlayerFileName &&
flashPlayerFileName === "pepflashplayer.dll" ||
flashPlayerFileName === "libpepflashplayer.so" ||
flashPlayerFileName === "pepperflashplayer.plugin")
{
isPPAPI = true;
}
return isPPAPI;
};
})();
alert("Using Pepper Flash? " + isUsingPepperFlash());
@JamesMGreene

This comment has been minimized.

Copy link
Owner Author

@JamesMGreene JamesMGreene commented May 29, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment