Merge pull request #3961 from atom/widevine-docs

Add documentation for using Widevine plugin
This commit is contained in:
Cheng Zhao 2015-12-30 16:46:31 +08:00
commit d4de4505b8
4 changed files with 81 additions and 2 deletions

View file

@ -18,6 +18,7 @@ select the tag that matches your version.
* [Using Selenium and WebDriver](tutorial/using-selenium-and-webdriver.md)
* [DevTools Extension](tutorial/devtools-extension.md)
* [Using Pepper Flash Plugin](tutorial/using-pepper-flash-plugin.md)
* [Using Widevine CDM Plugin](tutorial/using-widevine-cdm-plugin.md)
## Tutorials

View file

@ -0,0 +1,78 @@
# Using Widevine CDM Plugin
In Electron you can use the Widevine CDM plugin shipped with Chrome browser.
## Getting the plugin
Electron doesn't ship with the Widevine CDM plugin for license reasons, to get
it, you need to install the official Chrome browser first, which should match
the architecture and Chrome version of the Electron build you use.
### Windows & OS X
Open `chrome://components/` in Chrome browser, find `WidevineCdm` and make
sure it is up to date, then you can find all the plugin binaries from the
`APP_DATA/Google/Chrome/WidevineCDM/VERSION/_platform_specific/PLATFORM_ARCH/`
directory.
`APP_DATA` is system's location for storing app data, on Windows it is
`%LOCALAPPDATA%`, on OS X it is `~/Library/Application Support`. `VERSION` is
Widevine CDM plugin's version string, like `1.4.8.866`. `PLATFORM` is `mac` or
`win`. `ARCH` is `x86` or `x64`.
On Windows the required binaries are `widevinecdm.dll` and
`widevinecdmadapter.dll`, on OS X they are `libwidevinecdm.dylib` and
`widevinecdmadapter.plugin`. You can copy them to anywhere you like, but they
have to be put together.
### Linux
On Linux the plugin binaries are shipped together with Chrome browser, you can
find them under `/opt/google/chrome`, the filenames are `libwidevinecdm.so` and
`libwidevinecdmadapter.so`.
## Using the plugin
After getting the plugin files, you should pass the `widevinecdmadapter`'s path
to Electron with `--widevine-cdm-path` command line switch, and the plugin's
version with `--widevine-cdm-version` switch.
__Note:__ Though only the `widevinecdmadapter` binary is passed to Electron, the
`widevinecdm` binary has to be put aside it.
The command line switches have to be passed before the `ready` event of `app`
module gets emitted, and the page that uses this plugin must have plugin
enabled.
Example code:
```javascript
// You have to pass the filename of `widevinecdmadapter` here, it is
// * `widevinecdmadapter.plugin` on OS X,
// * `libwidevinecdmadapter.so` on Linux,
// * `widevinecdmadapter.dll` on Windows.
app.commandLine.appendSwitch('widevine-cdm-path', '/path/to/widevinecdmadapter.plugin');
// The version of plugin can be got from `chrome://plugins` page in Chrome.
app.commandLine.appendSwitch('widevine-cdm-version', '1.4.8.866');
var mainWindow = null;
app.on('ready', function() {
mainWindow = new BrowserWindow({
webPreferences: {
// The `plugins` have to be enabled.
plugins: true
}
})
});
```
## Verifying the plugin
To verify whether the plugin works, you can use following ways:
* Open devtools and check whether `navigator.plugins` includes the Widevine
CDM plugin.
* Open https://shaka-player-demo.appspot.com/ and load a manifest that uses
`Widevine`.
* Open http://www.dash-player.com/demo/drm-test-area/, check whether the page
says `bitdash uses Widevine in your browser`, then play the video.

View file

@ -8,7 +8,7 @@ import sys
BASE_URL = os.getenv('LIBCHROMIUMCONTENT_MIRROR') or \
'https://s3.amazonaws.com/github-janky-artifacts/libchromiumcontent'
LIBCHROMIUMCONTENT_COMMIT = '389d11b3bba3bdd536075c4743dec9ff4e0965ff'
LIBCHROMIUMCONTENT_COMMIT = '4e2ca6e3ca27c2cfcdda324b35124a10ac2d58e5'
PLATFORM = {
'cygwin': 'win32',

2
vendor/brightray vendored

@ -1 +1 @@
Subproject commit 3961caaa0a38aeb06e1afa4ef12fe9e7c6c24e5d
Subproject commit f50aa462aa9391d6995cf10a74b1b0ba41d04e81