2

I will start with specifying that I HAVE applied the application/vnd.adobe.flash.movie -> application/x-shockwave-flash (in /usr/share/mime/packages/freedesktop.org.xml) mime-type fix before and everything were working fine.

But recently something went wrong (maybe with an update, I don't know) and my browsers stopped playing flash files, Chrome offers to download it and Firefox just shows white screen. I tried using gnash but it doesn't work with some files and is very slow when it does. I don't believe my problem is unique, so maybe somebody knows how to fix it?

Linux Mint 18.3 KDE

EDIT: It is not a duplicate of the mentioned question as in that case Firefox still worked and the issue was with Chrome only. But I have completely lost access to swf.

migrated from askubuntu.com Jan 15 '18 at 15:27

This question came from our site for Ubuntu users and developers.

  • 4
    Possible duplicate of Chromium flash not playing on OpenSuse – Murphy Jan 15 '18 at 15:29
  • Same answer as Fox. The browsers do not support it anymore. The world has moved on. – Rui F Ribeiro Jan 15 '18 at 18:35
  • Given the hot mess and utter security nightmare that .swf was I'd call this the opposite of a problem. – Shadur Oct 27 '18 at 13:08
  • @Fox that is false, the browsers do support flash, firefox and chromium have never come bundled with a flash player installed, Chrome however still does. The flashplugin/pepper-flash simply need to be installed separately. I'm actually the person that posted the mime-type workaround on the arch forums back in the day. It still works for firefox, but firefox (for reasons shown in my answer below) won't open swf files, even if it has the capability to play them. – Cestarian Oct 27 '18 at 14:08
1

Before proceeding, you must make sure that pepper-flash is installed for Chrome/Chromium, (flashplugin for Firefox) the only way to check (without using the workaround below that is) is to play a flash file on the internet. (or in Firefox, go to about:plugins and see if it has "Shockwave Flash")

I have created the following script as a workaround:

#!/bin/bash
if [ -z $1 ]; then
   swf=$(ls *.swf | tail -1)
else
   swf=$@
fi


html=$(echo $swf | sed 's:swf:html:g')
echo '<embed src='$swf 'width="100%" height="100%"></embed>' | sed 's:src=:src=":g' | sed 's:swf:swf":g' > "$html"

#chromium "$html" && sleep 20 && rm "$html"
#google-chrome "$html" && sleep 20 && rm "$html"
#firefox about:config & wmctrl -xa firefox && sleep 0.2 && xdotool type plugins.http && sleep 1 && xdotool key Tab && xdotool key Down && xdotool key Return && xdotool key Control+w && firefox "$html" && firefox about:config && wmctrl -xa firefox && sleep 0.2 && xdotool type plugins.http && sleep 1 && xdotool key Tab && xdotool key Down && xdotool key Return && xdotool key Control+w && sleep 20 && rm "$html"

(alternatively compatible with dash)

To use the script, save it as swftohtml.sh(can be any name, does not have to end in .sh) at any location you desire, then to convert it into a runnable command either make an alias for it in bashrc, or copy it to /usr/bin/. Remember to run chmod +x swftohtml.sh to make it executable.

The script when run with no arguments will look in the current folder for an swf file and make a corresponding html file that can be used to run this swf file in a browser. If there are more than 1 swf files in the folder, it will default to the last one (e.g. if you have filename1.0.swf and filename2.0.swf, it will default to filename2.0.swf)

Alternatively to target a specific swf file, you can enter the filename (or complete path to file) as an argument for the script and it will use that instead. (e.g. swftohtml.sh filename 1.0.swf)

If you want to fully automate the script:

To open swf files automatically in your browser and automate removal of the resulting html file after it has been used, uncomment one of the following lines at the bottom of the script (depending on your browser):

#chromium "$html" && sleep 20 && rm "$html"
#google-chrome "$html" && sleep 20 && rm "$html"
#firefox about:config & wmctrl -xa firefox && sleep 0.2 && xdotool key Return && xdotool type plugins.http && sleep 1 && xdotool key Tab && xdotool key Down && xdotool key Return && xdotool key Control+w && firefox "$html" && firefox about:config && wmctrl -xa firefox && sleep 0.2 && xdotool key Return && xdotool type plugins.http && sleep 1 && xdotool key Tab && xdotool key Down && xdotool key Return && xdotool key Control+w && sleep 20 && rm "$html"

The script will now open the html file in your browser as soon as it has been created. If there is an existing instance of your browser running, it will delete the html file in 20 seconds (giving you ample time to tell the browser to open the file with it's flash plugin). If there is no existing instance of your browser, the file will instead be deleted 20 seconds after the browser is closed.

With this set, you can configure SWF files to open with the script, and the process is now fully automated so that you can open SWF files directly, without ever worrying about creating (or deleting) the html files by hand, in other words, it will behave like it should now. (Keep in mind that there may be a few corner cases where the html file is not deleted though, when this happens you can safely ignore it.)

For Firefox Users:

The Firefox version was a bit trickier, it requires wmctrl and xdotool to be installed. The reason for this is that for firefox to play local swf files this way you need to disable plugins.http_https_only in about:config, the script automatically disables it, opens the flash file, then re-enables it, because this is a setting most people will generally want to keep enabled. The browser needs to be open before the command is run. If you think it is likely your firefox browser will be closed when you run the command, replace the line with this:

firefox about:config & sleep 1 && wmctrl -xa firefox && sleep 0.2 && xdotool key Return && xdotool type plugins.http && sleep 1 && xdotool key Tab && xdotool key Down && xdotool key Return && xdotool key Control+w && firefox "$html" && firefox about:config && wmctrl -xa firefox && sleep 0.2 && xdotool key Return && xdotool type plugins.http && sleep 1 && xdotool key Tab && xdotool key Down && xdotool key Return && xdotool key Control+w && sleep 20 && rm "$html"

It will now give the browser 1 second to launch before running the rest of the script. (May need to be adjusted for slower computers).

The Firefox version of the script will always delete the file after 20 seconds.

Performance testing:

I did some rudimentary performance testing and these are my results:

  • Chrome/Chromium Pepper Flash (PPAPI): Fastest
  • Adobe Flash Projector (NPAPI)(Wine-Staging): Fast
  • Firefox Flashplugin (NPAPI): Slowest

As for stability, there are corner cases where PPAPI will run into bugs/errors that NPAPI does not, but they are rare.

The performance between Pepper Flash and Flash Projector was rather small (It's noticable, but barely) whereas the performance of the firefox flash plugin was noticably slower than the rest for some reason.

Thus, if playing flash games is the goal, I would recommend using chromium with pepper flash installed over the rest, in general. For other tasks it's unlikely that it will matter.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.