Browser plugins (简体中文)

From ArchWiki
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Tango-preferences-desktop-locale.png本文或本节需要翻译。要贡献翻译,请访问简体中文翻译团队Tango-preferences-desktop-locale.png

附注: Largely not translated(在 Talk:Browser plugins (简体中文)# 中讨论)

根据插件 API 的不同,浏览器的插件可以分为两种:

除非明确说明,本页中的插件都只支持 NPAPI。

Flash Player

Adobe Flash Player

Installation

不同的浏览器需要安装不同的插件。

注意:
  • 某些时候文本显示不太正常,可能需要从AUR安装ttf-ms-fontsAUR
  • freshplayerplugin-gitAUR 软件包提供了 NPAPI 浏览器比如 Firefox 使用 pepper-flashAUR 的测试版本。可以通过将 /usr/share/freshplayerplugin/freshwrapper.conf.example 复制到 /usr/share/freshplayerplugin/freshwrapper.conf 配置硬件加速。

更新

如果使用 Firefox,请查阅 此处的说明.

配置

To change the preferences (privacy settings, resource usage, etc.) of Flash Player, right click on any embedded Flash content (for instance adobe's flash home) and choose Settings from the menu.

You can also use the Flash settings file /etc/adobe/mms.cfg. Gentoo has an extensively commented example mms.cfg[失效链接 2021-05-09 ⓘ].

To enable video decoding with hardware video acceleration, add/uncomment the following line:

EnableLinuxHWVideoDecode = 1

It might also be required to add/uncomment the following line:

OverrideGPUValidation = 1

Multiple monitor full-screen fix

When using a multiple monitor setup, or swapping between virtual desktops, it is possible to lose focus on a fullscreen flash window. In such a case, the adobe flash-plugin will automatically exit full-screen mode. This may not be to your liking.

Unfortunately, this behavior is hard coded into the binary. In order to change this behavior it is necessary to alter the binary.

Fixing this issue only works for the NPAPI plugin and this issue can be fixed via 2 ways.

After the package has been installed, backup libflashplayer.so:
# cp /usr/lib/mozilla/plugins/libflashplayer.so /usr/lib/mozilla/plugins/libflashplayer.so.backup
Then, you will need to alter that file using a hex editor like ghex. You must open it with root privileges obviously.
# ghex /usr/lib/mozilla/plugins/libflashplayer.so
Using the hex editor find the string _NET_ACTIVE_WINDOW. In ghex the readable string is on the right hand side of the window, and the hex is on the left, you are trying to locate the readable string. It should be easy to find using a search function.
Upon finding _NET_ACTIVE_WINDOW rewrite the line, but do not change the length of the line, for example _NET_ACTIVE_WINDOW becomes _XET_ACTIVE_WINDOW.
Save the binary, and restart any processes using the plugin (as this will crash any instance of the plugin in use.)

Playing DRM-protected content

See Flash DRM content.

Shumway

Shumway[失效链接 2020-12-20 ⓘ] 尝试直接使用 HTML5 技术而不是本地代码处理和显示 SWF 文件,已经 停止开发

Gnash

Gnash 是 Adobe Flash Player 的自由软件替代。可以作为单独的播放器,也可以嵌入浏览器。支持 SWF v7 和 80% 的 ActionScript 2.0。

可以通过软件包gnashAUR[损坏的链接:package not found], gnash-kde4AUR[损坏的链接:package not found], gnash-gitAUR.

Lightspark

Lightspark[失效链接 2021-05-09 ⓘ] is another attempt to provide a free alternative to Adobe Flash aimed at supporting newer Flash formats. Lightspark has the ability to fall back on Gnash for old content, which enables users to install both and enjoy wider coverage. Although it is still very much in development, it supports some popular sites.

Lightspark can be installed with the lightspark-gitAUR package.

PDF浏览器

PDF.js

PDF.js is a PDF renderer created by Mozilla and built using HTML5 technologies.

It is included in Firefox.

For Chromium and Google Chrome it is available as extension in the Chrome Web Store.

External PDF viewers

To use an external PDF viewer you need #MozPlugger.

If you want to use MozPlugger with Evince, for example, you have to find the lines containing pdf in the /etc/mozpluggerrc file and modify the corresponding line after GV() as below:

repeat noisy swallow(evince) fill: evince "$file"

(replace evince with something else if it is not your viewer of choice).

If this is not enough, you may need to change 2 values in about:config:

  • Change pdfjs.disabled's value to true;
  • Change plugin.disable_full_page_plugin_for_types's value to an empty value.

Restart and it should work like a charm!

中国的在线支付

中国的第三方在线支付网站通常采用所谓的“安全插件”来输入密码。这些 NPAPI 插件在 Firefox 52+ 中已不再支持,可以尝试使用 palemoonAUR

Citrix

参见:Citrix

Java

注意: Both Java plugins are NPAPI-only and thus do not work in Chromium and Opera.

To enable Java support in your browser, you have two options: the open-source OpenJDK (recommended) or Oracle's proprietary version. For details about why OpenJDK is recommended see this.

To use OpenJDK, you have to install the IcedTea[失效链接 2021-11-07 ⓘ] browser plugin, icedtea-web.

If you want to use Oracle's JRE, install the jreAUR package.

See Java#OpenJDK for additional details and references.

注意: If you experience any problems with the Java plugin (e.g. it is not recognized by the browser), you can try this solution.

Pipelight

See Pipelight.

视频播放插件

很多浏览器支持通过 GStreamer 框架播放 HTML5 <audio><video>。安装时注意查看浏览器的可选依赖关系(或 webkitgtkAUR/webkitgtk2AUR 依赖关系)确认支持的 GStreamer 版本,可能是当前 gst-* 版本或老的 gstreamer0.10-* 版本。详情参考 GStreamer#Installation.

其它插件

  • Gecko 媒体播放器 — Mozilla 处理网页多媒体的插件,使用 MPlayer.
https://sites.google.com/site/kdekorte2/gecko-mediaplayer || gecko-mediaplayer[损坏的链接:package not found]
https://wiki.gnome.org/Apps/Videos || totem
  • Rosa Media Player Plugin — 基于 MPlayer 的 Qt 浏览器插件.
https://abf.rosalinux.ru/uxteam/ROSA_Media_Player || rosa-media-player-pluginAUR
  • VLC Plugin — NPAPI 接口,VLC 插件.
https://code.videolan.org/videolan/npapi-vlc || npapi-vlcAUR

其他

MozPlugger

MozPlugger can be installed with the mozpluggerAUR package.

MozPlugger is a Mozilla plugin which can show many types of multimedia inside your browser. To accomplish this, it uses external programs such as MPlayer, xine, Evince, OpenOffice, TiMidity, etc. To modify or add applications to be used by MozPlugger just modify the /etc/mozpluggerrc file.

For example, MozPlugger uses OpenOffice by default to open doc files. To change it to use LibreOffice instead, look for the OpenOffice section:

/etc/mozpluggerrc
...
### OpenOffice
define([OO],[swallow(VCLSalFrame) fill: ooffice2.0 -nologo -norestore -view $1 "$file"
    swallow(VCLSalFrame) fill: ooffice -nologo -norestore -view $1 "$file"
    swallow(VCLSalFrame) fill: soffice -nologo $1 "$file"])
...

and add LibreOffice at the beginning of the list:

/etc/mozpluggerrc
...
### LibreOffice/OpenOffice
define([OO],[swallow(VCLSalFrame) fill: libreoffice --nologo --norestore --view $1 "$file"
    swallow(VCLSalFrame) fill: ooffice2.0 -nologo -norestore -view $1 "$file"
    swallow(VCLSalFrame) fill: ooffice -nologo -norestore -view $1 "$file"
    swallow(VCLSalFrame) fill: soffice -nologo $1 "$file"])
...
注意: Be sure to also choose LibreOffice as your preferred application to open doc files.

As another simple example, if you want to open cpp files with your favorite text editor (we will use Kate) to get syntax highlighting, just add a new section to your mozpluggerrc file:

/etc/mozpluggerrc
text/x-c++:cpp:C++ Source File
text/x-c++:hpp:C++ Header File
    repeat noisy swallow(kate) fill: kate -b "$file"

To change the default of MPlayer so that mpv is used instead, change the appropriate lines such that:

/etc/mozpluggerrc
...
### MPlayer

#define(MP_CMD,[mplayer -really-quiet -nojoystick -nofs -zoom -vo xv,x11 -ao esd,alsa,oss,arts,null -osdlevel 0 $1 </dev/null])
define(MP_CMD,[mpv -really-quiet $1 </dev/null])

#define(MP_EMBED,[embed noisy ignore_errors: MP_CMD(-xy $width -wid $window $1)])
define(MP_EMBED,[embed noisy ignore_errors: MP_CMD(--autofit=$width -wid $window $1)])

#define(MP_NOEMBED,[noembed noisy ignore_errors maxaspect swallow(MPlayer): MP_CMD($1)])
define(MP_NOEMBED,[noembed noisy ignore_errors maxaspect swallow(mpv): MP_CMD($1)])

...

#define(MP_AUDIO,[mplayer -quiet -nojoystick $1 </dev/null])
define(MP_AUDIO,[mpv -really-quiet $1 </dev/null])

#define(MP_AUDIO_STREAM,[controls stream noisy ignore_errors: mplayer -quiet -nojoystick $1 "$file" </dev/null])
define(MP_AUDIO_STREAM,[controls stream noisy ignore_errors: mpv -really-quiet $1 "$file" </dev/null])
...

For a more complete list of MozPlugger options see this page.

疑难解答

Flash无声音

Flash Player只通过默认的ALSA设备输出音频(编号0)。如果使用多个声音设备(比如,除了声卡外,使用了显卡的HDMI输出),可能你要使用的声音设备编号不是0,从而导致Flash无声音。

例如:

$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: Generic [HD-Audio Generic], device 3: HDMI 0 [HDMI 0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: DX [Xonar DX], device 0: Multichannel [Multichannel]
  Subdevices: 0/1
  Subdevice #0: subdevice #0
card 1: DX [Xonar DX], device 1: Digital [Digital]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

上面的示例中,HDMI设备编号为0,而声卡编号为1。要将该声卡作为ALSA默认输入,创建~/.asoundrc,内容如下:

pcm.!default {
type hw
card 1
}

ctl.!default {
type hw
card 1
}

Flash独占了声音设备

如果发现播放Flash时其他程序无法正常播放声音,那么可能是由于没有加载snd_pcm_oss模块:

$ lsmod | grep snd_pcm_oss

重新加载:

# rmmod snd_pcm_oss

并重启浏览器即可。

Flash性能

Adobe的Flash插件有严重的性能问题,尤其是在CPU使用自动降频功能时。参见:CPU frequency scaling (简体中文)#调节 ondemand 调速器

Flash中webcam分辨率低

尝试使用如下命令启动浏览器:

$ LD_PRELOAD=/usr/lib/libv4l/v4l1compat.so [broswer]

Black bars in fullscreen video playback on multiheaded desktops

The Flash plugin has a known bug where the full screen mode does not really work when you have a multi-monitor setup. Apparently, it incorrectly determines the full screen resolution, so the full screen Flash Player fills the correct monitor but gets scaled as if the monitor had the resolution of the total display area.

To fix this, you can use the "hack" described here. Simply download the source from the link given on the page, and follow the instructions in the README.

提示: The hack is available and can be installed with the fullscreenhackAUR[损坏的链接:package not found] package.
注意: While the author mentions using NVDIA's TwinView, the hack should work for any multi-monitor setup.

Flash Player: plugin version still shown older version after upgrade

Solution for Firefox: delete file "pluginreg.dat" in user's profile directory.

  • Close firefox
  • Go to /home/<username>/.mozilla/firefox/<profile_folder>/
  • Delete file "pluginreg.dat"

Firefox will automatically rebuild this file once it is started again. Make sure to substitute <username> and <profile_folder> with the appropriate information.

插件安装后无法使用

这通常是因为第一次安装插件后,用户未重登录,插件路径还未设置。测试如下变量:

echo $MOZ_PLUGIN_PATH

若未设置,请尝试重新登录, 或:

$ source /etc/profile.d/mozilla-common.sh && firefox

Gecko Media Player 无法播放 Apple Trailers

设置浏览器的用户代理(user agent)为:

QuickTime/7.6.2 (qtver=7.6.2;os=Windows NT 5.1Service Pack 3)