Adobe Flash Player 11.2 将是支持 Linux 平台的最后一个版本.
Adobe 只继续为 Flash Player 11.2 for Linux 提供安全更新,而不提供版本更新.
Linux上为Firefox添加Flash Player支持也非常简单.
下载Adobe为Linux提供的tar.gz包:
https://get.adobe.com/cn/flashplayer/
把压缩包里的libflashplayer.so复制或软链接到/usr/lib/mozilla/plugins/即可.
因为Chromium/Opera/Maxthon跟Chrome内核是一样的,
所以默认就能加载Chrome的Flash插件/opt/google/chrome/PepperFlash,
而要在Firefox上使用PepperFlash,则需要通过第三方插件
FreshPlayerPlugin来加载.
这里先提一下,FreshPlayerPlugin这种非官方的方式稳定性并不好,但可以一试.
Firefox for Linux:
ftp://ftp.mozilla.org/pub/firefox/releases/33.0.3/linux-x86_64/zh-CN/
ftp://ftp.mozilla.org/pub/firefox/releases/33.0.3/linux-i686/zh-CN/
Chrome for Ubuntu/Debian Stable:
https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
https://dl.google.com/linux/direct/google-chrome-stable_current_i386.deb
上面是Firefox和Chrome的下载地址,因为PepperFlash集成在Chrome里,所以需要安装Chrome。
当然也可以不安装Chrome,把PepperFlash解压后软链接到/opt/google/chrome/下面也可以,
比如我把PepperFlash解压到/home/eechen/apps/firefox/flash/PepperFlash:
sudo mkdir -p /opt/google/chrome/
sudo ln -s /home/eechen/apps/firefox/flash/PepperFlash /opt/google/chrome/
webupd8为Ubuntu编译了二进制版本freshplayerplugin,就不需要自己手动编译了.
下载对应你的系统版本的
freshplayerplugin,我的是64位的Ubuntu14.04(trusty)所以我下载:
wget http://ppa.launchpad.net/nilarimogard/webupd8/ubuntu/pool/main/f/freshplayerplugin/freshplayerplugin_0.2.1+git20150107~webupd8~trusty0_amd64.deb
比如我把freshplayerplugin里的libfreshwrapper-pepperflash.so解压到/home/eechen/apps/firefox/flash/libfreshwrapper-pepperflash.so
然后我把它软链接到Firefox的插件目录:
sudo ln -s /home/eechen/apps/firefox/flash/libfreshwrapper-pepperflash.so /usr/lib/mozilla/plugins/
重启Firefox访问about:plugins即可看到Firefox成功加载了Chrome的PepperFlash:
关键Flash Stage3D硬件加速:
在默认情况下,Ubuntu下Chrome的Flash Stage3D由软件模拟,运行Flash Stage3D游戏时性能很差,
CPU温度高达57度,CPU使用率高达300%,而且帧速很低,卡顿.
Ubuntu上运行Chrome,访问chrome://flags/,启用"覆盖软件渲染列表",重启Chrome,查看chrome://gpu/,可见Flash Stage3D已经开启硬件加速.
运行下面的 Flash Stage3D 赛车游戏:
http://www8.agame.com/mirror/flash/r/Rallypoint_extreme/Rally_Point_Extreme3/Bin/
CPU温度在47度左右(较平常升高了5度),CPU使用率在20%(i5-3230M为四线程,满载为400%).
http://static.oschina.net/uploads/space/2014/1015/225311_vR45_561214.png
http://helpx.adobe.com/x-productkb/multi/stage3d-unsupported-chipsets-drivers-flash.html
里面提到,Linux上的Flash Stage3D硬件加速只支持Chrome PepperFlash.
Linux上Firefox的Flash插件不能使用硬件加速Stage3D,只能使用软件模拟,所以速度慢,耗CPU,发热量大.
不过一般的Flash视频应该是没有用到Stage3D硬件加速的,所以用Firefox+Flash11.2看视频不是太大的问题.
但是,Firefox用FreshPlayerPlugin插件使用PepperFlash的方式就可以开启Flash Stage3D硬件加速了:
新建一个文件/home/eechen/apps/firefox/flash/
freshwrapper.conf,内容如下:
# Configuration options for FreshPlayerPlugin
# This configuration file is optional. Wrapper will search for it first
# in ~/.config/freshwrapper.conf, then in /etc/freshwrapper.conf.
# If wrapper fails to find configuration, it will use default values,
# which you can find below
# Audio buffer is used to continuously provide sound adapter with data.
# Values too low may lead to buffer underruns and stuttering. Values
# too high will lead to noticeable latency. Usually plugin selects size
# on its own, but you may override bounds here
# lower bound for audio buffer size, in milliseconds
audio_buffer_min_ms = 20
# higher bound of audio buffer size, in milliseconds
audio_buffer_max_ms = 500
# Path to the Pepper Flash plugin
pepperflash_path = "/opt/google/chrome/PepperFlash/libpepflashplayer.so"
# "Command-line" arguments for Flash
flash_command_line = "enable_hw_video_decode=1,enable_stagevideo_auto=1"
# enable 3d and stage 3d
enable_3d = 1
# enable 3d for wmode=transparent instances
enable_3d_transparent = 1
# when set to 1, limits output to warnings and errors only
quiet = 0
然后把它软链接到配置目录:
ln -s /home/eechen/apps/firefox/flash/freshwrapper.conf /home/eechen/.config/freshwrapper.conf
下载cubes_stage3d来对比下Chrome和Firefox各自使用PepperFlash的Stage3D硬件加速性能:
http://airtightinteractive.com/demos/flash/stage3d/cubes/cubes_stage3d.zip
分别用Firefox和Chrome访问cubes_stage3d/bin-release/index.html,在我的电脑(i5-3230M,无独显,分辨率1366x768,Ubuntu14.04)上:
100个立方体,Chrome达到60FPS,CPU空闲率为89%,稳定.
100个立方体,Firefox达到58FPS,CPU空闲率为85%,有时候会出现闪烁.
最后,说一下Opera.基于Chrome39的Opera26是首个支持Linux的稳定版本,Opera可以自动加载Chrome的Pepper Flash Player来提供Flash支持:
http://dl-desktop.oupeng.com/pub/opera/desktop/26.0.1656.32/linux/
Opera里访问about://flags启用#ignore-gpu-blacklist即可让Flash支持Stage3D硬件加速.