Interface Widevine
Widevine is used to protect digital content and ensure that it is accessed and used in compliance with licensing agreements.
To use Widevine, you must activate it every time you create a new Engine instance. By
default, Widevine is not activated. Once activated, you can play protected content such as
Netflix, Amazon Prime Video, etc. in the browsers of the engine.
The Widevine component files are stored in the user data directory of the engine.
On Windows and macOS, you can activate Widevine without specifying a custom user data directory. There's no need to restart the engine after first activation or update, as the changes are applied automatically.
On Linux, you must specify a custom user data directory to activate Widevine. It is required due to the way Widevine is implemented on Linux. When the component is activated for the first time, or it is updated to the latest version during activation, the engine must be restarted to apply the changes. To find out if the restart is required, check the activation status:
var status = engine.widevine().activate().join();
if (status == WidevineActivationStatus.RESTART_REQUIRED) {
// Engine restart is required.
}
Important: Widevine is a Google proprietary component, governed by its own terms of use. For more information, see https://www.widevine.com/. TeamDev shall not be responsible for your use of Widevine.
- Since:
- 8.9.0
-
Method Details
-
engine
Engine engine()Returns theEngineinstance of this Widevine component. -
isActivated
boolean isActivated()Checks if the Widevine component is activated.- Throws:
ObjectClosedException- if the engine is closed
-
activate
CompletableFuture<WidevineActivationStatus> activate()Activates the Widevine component and updates it to the latest version if it is available.The Widevine component files are stored in the user data directory of the engine.
On Windows and macOS, you can activate Widevine without specifying a custom user data directory. There's no need to restart the engine after first activation or update, as the changes are applied automatically.
On Linux, you must specify a custom user data directory to activate Widevine. It is required due to the way Widevine is implemented on Linux. When the component is activated for the first time, or it is updated to the latest version during activation, the engine must be restarted to apply the changes.
Here is an example of how to specify a custom user data directory and restart the engine if it is required:
var options = EngineOptions.newBuilder(HARDWARE_ACCELERATED) // Specify a custom user data directory. .userDataDir(Paths.get("path/to/user/data/dir")) .build(); Engine engine = Engine.newInstance(options); // Activate Widevine and restart the engine if necessary. var status = engine.widevine().activate().join(); if (status == WidevineActivationStatus.RESTART_REQUIRED) { // Restart the engine with the same options. engine.close(); engine = Engine.newInstance(options); } Browser browser = engine.newBrowser();- Returns:
- the status of the Widevine activation
- Throws:
IllegalStateException- when the Widevine component is being activated on Linux without a custom user data directoryObjectClosedException- if the engine is closed- See Also:
-