PepperFlash specifics using Electron on Mac

Many software companies that are using Flash in their software products have to find a solution of the FlashPlayer end of life. One option is to replace their Flash based software solution with something written in modern web technologies like HTML5, JS, CSS. Another option is to keep supporting Flash even after the end of 2020 in a “custom” browser (Chromium in new clothes for example). These two are not the only solutions, but they are the most popular ones.

The preferred workaround for supporting FlashPlayer is to create an Electron (Chromium) based native app that uses PepperFlash (alternative of the FlashPlayer that’s working in Chrome) to support any legacy Flash content.

So far, this is quite good solution, because this buys the company a little more time to “convert” their software to something that’s can be executed by any modern browser without any troubles.

Once you dive in the Electron development you will find a lot of different cool things (like auto-update, compressed app content) as well and some problems.If you need native development (macOS or mobile) and consulting services you can get in touch with us here.

Image for post
Image for post

One problem that you can face, when an Electron app is optimized (usually using ASAR) on Mac, is that PepperFlash stops working when you release your app. You can read a bit more here. In short, you test while developing — everything works as expected, but once when a release version of the app is build and started then the Flash is not working. You see the text — Couldn’t load plug-in.

You should start looking 👀 around for a solution, but this might take some time⌛️ before it clicks. Here are two solutions that will help you, but you have to decide which one will fit best in you case.

Here is just a part of our Electron project structure.

Image for post
Image for post
PepperFlash in an Electron App

First solution is to add the following item “./resources/pepperFlash/mac/**” to the “extraResources” key in your build configuration for macOS. Also the app should load the plugin slightly different when ASAR is active or not.

How to load a plugin which is not in the asar

An alternative solution is to exclude the plugin from the asar archive. This places the plugin in app.asar.unpacked folder in the Electron app. This can be done with the following configuration change.

Add this key (or adjust its value) to the

In such case the PepperFlash plugin loading should be done with the following code:

Update the location of the plugin

The solution takes care only for the macOS version because the plugin is causing problems only under these specif conditions — Electron on macOS with asar.

If you have any question or you have another solution feel free to get in touch.

Written by

IT Consultant & Technical Architect, Freelance-Network Founder, Mobile Development Expert

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store