mirror of
https://github.com/LCTT/TranslateProject.git
synced 2025-01-13 22:30:37 +08:00
translated (#10442)
This commit is contained in:
parent
94d3e5cbb6
commit
37a2496ab0
@ -1,76 +0,0 @@
|
|||||||
translating---geekpi
|
|
||||||
|
|
||||||
Add YouTube Player Controls To Your Linux Desktop With browser-mpris2 (Chrome Extension)
|
|
||||||
======
|
|
||||||
A Unity feature that I miss (it only actually worked for a short while though) is automatically getting player controls in the Ubuntu Sound Indicator when visiting a website like YouTube in a web browser, so you could pause or stop the video directly from the top bar, as well as see the video / song information and a preview.
|
|
||||||
|
|
||||||
This Unity feature is long dead, but I was searching for something similar for Gnome Shell and I came across **[browser-mpris2][1], an extension that implements a MPRIS v2 interface for Google Chrome / Chromium, which currently only supports YouTube** , and I thought there might be some Linux Uprising readers who'll like this.
|
|
||||||
|
|
||||||
**The extension also works with Chromium-based web browsers like Opera and Vivaldi.**
|
|
||||||
**
|
|
||||||
** **browser-mpris2 also supports Firefox but since loading extensions via about:debugging is temporary, and this is needed for browser-mpris2, this article doesn't include Firefox instructions. The developer[intends][2] to submit the extension to the Firefox addons website in the future.**
|
|
||||||
|
|
||||||
**Using this Chrome extension you get YouTube media player controls (play, pause, stop and seeking) in MPRIS2-capable applets**. For example, if you use Gnome Shell, you get YouTube media player controls as a permanent notification or, you can use an extension like Media Player Indicator for this. In Cinnamon / Linux Mint with Cinnamon, it shows up in the Sound Applet.
|
|
||||||
|
|
||||||
**It didn't work for me on Unity** , I'm not sure why. I didn't try this extension with other MPRIS2-capable applets available in various desktop environments (KDE, Xfce, MATE, etc.). If you give it a try, let us know if it works with your desktop environment / MPRIS2 enabled applet.
|
|
||||||
|
|
||||||
Here is a screenshot with [Media Player Indicator][3] displaying information about the currently playing YouTube video, along with its controls (play/pause, stop and seeking), on Ubuntu 18.04 with Gnome Shell and Chromium browser:
|
|
||||||
|
|
||||||
![](https://1.bp.blogspot.com/-rsc4FpYBSrI/W3VtPphfdOI/AAAAAAAABXY/YfKV6pBncs0LAwTwYSS0tKRJADDfZDBfwCLcBGAs/s640/browser-mpris2-gnome-shell-sound-indicator.png)
|
|
||||||
|
|
||||||
And in Linux Mint 19 Cinnamon with its default sound applet and Chromium browser:
|
|
||||||
|
|
||||||
![](https://2.bp.blogspot.com/-I2DuYetv7eQ/W3VtUUcg26I/AAAAAAAABXc/Tv-RemkyO60k6CC_mYUxewG-KfVgpFefACLcBGAs/s1600/browser-mpris2-cinnamon-linux-mint.png)
|
|
||||||
|
|
||||||
### How to install browser-mpris2 for Google Chrome / Chromium
|
|
||||||
|
|
||||||
**1\. Install Git if you haven't already.**
|
|
||||||
|
|
||||||
In Debian / Ubuntu / Linux Mint, use this command to install git:
|
|
||||||
```
|
|
||||||
sudo apt install git
|
|
||||||
|
|
||||||
```
|
|
||||||
|
|
||||||
**2\. Download and install the[browser-mpris2][1] required files.**
|
|
||||||
|
|
||||||
The commands below clone the browser-mpris2 Git repository and install the chrome-mpris2 file to `/usr/local/bin/` (run the "git clone..." command in a folder where you can continue to keep the browser-mpris2 folder because you can't remove it, as it will be used by Chrome / Chromium):
|
|
||||||
```
|
|
||||||
git clone https://github.com/otommod/browser-mpris2
|
|
||||||
sudo install browser-mpris2/native/chrome-mpris2 /usr/local/bin/
|
|
||||||
|
|
||||||
```
|
|
||||||
|
|
||||||
**3\. Load the extension in Chrome / Chromium-based web browsers.**
|
|
||||||
|
|
||||||
![](https://3.bp.blogspot.com/-yEoNFj2wAXM/W3Vvewa979I/AAAAAAAABXo/dmltlNZk3J4sVa5jQenFFrT28ecklY92QCLcBGAs/s640/browser-mpris2-chrome-developer-load-unpacked.png)
|
|
||||||
|
|
||||||
Open Google Chrome, Chromium, Opera or Vivaldi web browsers, go to the Extensions page (enter `chrome://extensions` in the URL bar), enable `Developer mode` using the toggle available in the top right-hand side of the screen, then select `Load Unpacked` and select the chrome-mpris2 directory (make sure to not select a subfolder).
|
|
||||||
|
|
||||||
Copy the extension ID and save it because you'll need it later (it's something like: `emngjajgcmeiligomkgpngljimglhhii` but it's different for you so make sure to use the ID from your computer!) .
|
|
||||||
|
|
||||||
**4\. Run** `install-chrome.py` (from the `browser-mpris2/native` folder), specifying the extension id and chrome-mpris2 path.
|
|
||||||
|
|
||||||
Use this command in a terminal (replace `REPLACE-THIS-WITH-EXTENSION-ID` with the browser-mpris2 extension ID displayed under `chrome://extensions` from the previous step) to install this extension:
|
|
||||||
```
|
|
||||||
browser-mpris2/native/install-chrome.py REPLACE-THIS-WITH-EXTENSION-ID /usr/local/bin/chrome-mpris2
|
|
||||||
|
|
||||||
```
|
|
||||||
|
|
||||||
You only need to run this command once, there's no need to add it to startup or anything like that. Any YouTube video you play in Google Chrome or Chromium browsers should show up in whatever MPRISv2 applet you're using. There's no need to restart the web browser.
|
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
via: https://www.linuxuprising.com/2018/08/add-youtube-player-controls-to-your.html
|
|
||||||
|
|
||||||
作者:[Logix][a]
|
|
||||||
选题:[lujun9972](https://github.com/lujun9972)
|
|
||||||
译者:[译者ID](https://github.com/译者ID)
|
|
||||||
校对:[校对者ID](https://github.com/校对者ID)
|
|
||||||
|
|
||||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
|
||||||
|
|
||||||
[a]:https://plus.google.com/118280394805678839070
|
|
||||||
[1]:https://github.com/otommod/browser-mpris2
|
|
||||||
[2]:https://github.com/otommod/browser-mpris2/issues/11
|
|
||||||
[3]:https://extensions.gnome.org/extension/55/media-player-indicator/
|
|
@ -0,0 +1,76 @@
|
|||||||
|
使用 browser-mpris2(Chrome 扩展)将 YouTube 播放器控件添加到 Linux 桌面
|
||||||
|
======
|
||||||
|
一个我怀念的 Unity 功能(虽然只使用了一小段时间)是在 Web 浏览器中访问 YouTube 等网站时自动获取 Ubuntu 声音指示器中的播放器控件,因此你可以直接从顶部栏暂停或停止视频,以及浏览视频/歌曲信息和预览。
|
||||||
|
|
||||||
|
这个 Unity 功能已经消失很久了,但我正在为 Gnome Shell 寻找类似的东西,然后我遇到了 **[browser-mpris2][1],这是一个为 Google Chrome/Chromium 实现 MPRIS v2 接口的扩展,目前只支持 YouTube**,我想可能会有一些 Linux Uprising 的读者会喜欢这个。
|
||||||
|
|
||||||
|
**该扩展还适用于 Opera 和 Vivaldi 等基于 Chromium 的 Web 浏览器。**
|
||||||
|
**
|
||||||
|
** **browser-mpris2 也支持 Firefox,但因为通过 about:debugging 加载扩展是临时的,而这是 browser-mpris2 所需要的,因此本文不包括 Firefox 的指导。开发人员[打算][2]将来将扩展提交到 Firefox 插件网站上。**
|
||||||
|
|
||||||
|
**使用此 Chrome 扩展,你可以在支持 MPRIS2 的 applets 中获得 YouTube 媒体播放器控件(播放、暂停、停止和查找
|
||||||
|
)**。例如,如果你使用 Gnome Shell,你可将 YouTube 媒体播放器控件作为永久通知,或者你可以使用 Media Player Indicator 之类的扩展来实现此目的。在 Cinnamon /Linux Mint with Cinnamon 中,它出现在声音 Applet 中。
|
||||||
|
|
||||||
|
**我无法在 Unity 上用它**,我不知道为什么。我没有在不同桌面环境(KDE、Xfce、MATE 等)中使用其他支持 MPRIS2 的 applet 尝试此扩展。如果你尝试过,请告诉我们它是否适用于你的桌面环境/支持 MPRIS2 的 applet。
|
||||||
|
|
||||||
|
以下是在使用 Gnome Shell 的 Ubuntu 18.04 并装有 Chromium 浏览器的[媒体播放器指示器][3]的截图,其中显示了有关当前正在播放的 YouTube 视频的信息及其控件(播放/暂停,停止和查找):
|
||||||
|
|
||||||
|
![](https://1.bp.blogspot.com/-rsc4FpYBSrI/W3VtPphfdOI/AAAAAAAABXY/YfKV6pBncs0LAwTwYSS0tKRJADDfZDBfwCLcBGAs/s640/browser-mpris2-gnome-shell-sound-indicator.png)
|
||||||
|
|
||||||
|
在 Linux Mint 19 Cinnamon 中使用其默认声音 applet 和 Chromium 浏览器的截图:
|
||||||
|
|
||||||
|
|
||||||
|
![](https://2.bp.blogspot.com/-I2DuYetv7eQ/W3VtUUcg26I/AAAAAAAABXc/Tv-RemkyO60k6CC_mYUxewG-KfVgpFefACLcBGAs/s1600/browser-mpris2-cinnamon-linux-mint.png)
|
||||||
|
|
||||||
|
### 如何为 Google Chrom/Chromium安装 browser-mpris2
|
||||||
|
|
||||||
|
**1\. 如果你还没有安装 Git 就安装它**
|
||||||
|
|
||||||
|
在 Debian/Ubuntu/Linux Mint 中,使用此命令安装 git:
|
||||||
|
```
|
||||||
|
sudo apt install git
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
**2\. 下载并安装 [browser-mpris2][1] 所需文件。**
|
||||||
|
|
||||||
|
下面的命令克隆了 browser-mpris2 的 Git 仓库并将 chrome-mpris2 安装到 `/usr/local/bin/`(在一个你可以保存 browser-mpris2 文件夹的地方运行 “git clone ...” 命令,由于它会被 Chrome/Chromium 使用,你不能删除它):
|
||||||
|
```
|
||||||
|
git clone https://github.com/otommod/browser-mpris2
|
||||||
|
sudo install browser-mpris2/native/chrome-mpris2 /usr/local/bin/
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
**3\. 在基于 Chrome/Chromium 的 Web 浏览器中加载此扩展。**
|
||||||
|
|
||||||
|
![](https://3.bp.blogspot.com/-yEoNFj2wAXM/W3Vvewa979I/AAAAAAAABXo/dmltlNZk3J4sVa5jQenFFrT28ecklY92QCLcBGAs/s640/browser-mpris2-chrome-developer-load-unpacked.png)
|
||||||
|
|
||||||
|
打开 Google Chrome、Chromium、Opera 或 Vivaldi 浏览器,进入 Extensions 页面(在 URL 栏中输入 `chrome://extensions`),在屏幕右上角切换到`开发者模式`。然后选择 `Load Unpacked` 并选择 chrome-mpris2 目录(确保没有选择子文件夹)。
|
||||||
|
|
||||||
|
复制扩展 ID 并保存它,因为你以后需要它(它类似于这样:`emngjajgcmeiligomkgpngljimglhhii`,但它会与你的不一样,因此确保使用你计算机中的 ID!)。
|
||||||
|
|
||||||
|
**4\. 运行 **`install-chrome.py`**(在 `browser-mpris2/native` 文件夹中),指定扩展 id 和 chrome-mpris2 路径。
|
||||||
|
|
||||||
|
在终端中使用此命令(将 `REPLACE-THIS-WITH-EXTENSION-ID` 替换为上一步中 `chrome://extensions` 下显示的 browser-mpris2 扩展 ID)安装此扩展:
|
||||||
|
```
|
||||||
|
browser-mpris2/native/install-chrome.py REPLACE-THIS-WITH-EXTENSION-ID /usr/local/bin/chrome-mpris2
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
你只需要运行此命令一次,无需将其添加到启动或其他类似的地方。你在 Google Chrome 或 Chromium 浏览器中播放的任何 YouTube 视频都应显示在你正在使用的任何 MPRISv2 applet 中。你无需重启 Web 浏览器。
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
via: https://www.linuxuprising.com/2018/08/add-youtube-player-controls-to-your.html
|
||||||
|
|
||||||
|
作者:[Logix][a]
|
||||||
|
选题:[lujun9972](https://github.com/lujun9972)
|
||||||
|
译者:[geekpi](https://github.com/geekpi)
|
||||||
|
校对:[校对者ID](https://github.com/校对者ID)
|
||||||
|
|
||||||
|
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||||
|
|
||||||
|
[a]:https://plus.google.com/118280394805678839070
|
||||||
|
[1]:https://github.com/otommod/browser-mpris2
|
||||||
|
[2]:https://github.com/otommod/browser-mpris2/issues/11
|
||||||
|
[3]:https://extensions.gnome.org/extension/55/media-player-indicator/
|
Loading…
Reference in New Issue
Block a user