Package com.castlabs.sdk.drm

# Class DrmDeviceTimeCheckerPlugin

java.lang.Object
com.castlabs.android.Plugin
com.castlabs.sdk.drm.DrmDeviceTimeCheckerPlugin

public class DrmDeviceTimeCheckerPlugin extends Plugin
This plugin will perform periodic checks related to DRM licensing.

In order to workaround a Widevine limitation this plugin performs some time-related checks while playing protected content. The limitation lies in changing the local device time in order to trick the DRM Content Decryption Module (CDM).

If the license is expired, the plugin will stop playback and throw a fatal exception (`CastlabsPlayerException.SEVERITY_ERROR`) of type `CastlabsPlayerException.TYPE_KEY_EXPIRED`. Before you can use this plugin, you need to register it with the `PlayerSDK` before you initialize the SDK itself. For example:

         PlayerSDK.register(new DrmDeviceTimeCheckerPlugin());
         // ...
         PlayerSDK.init(getApplicationContext());

Optionally, you can specify the time period at which he license checks should be performed. Default value is every 5 minutes (`DEFAULT_CHECK_INTERVAL_SEC`).

         // ...
         PlayerSDK.register(new DrmDeviceTimeCheckerPlugin(60)); // Check every minute
         // ...

This plugin needs two extra Android permissions. These permissions allow to internally keep track of license times.

- `Intent.ACTION_BOOT_COMPLETED`
- `Intent.ACTION_TIME_CHANGED`

These permissions are automatically added to your AndroidManifest file once you include this plugin in your build file.

This plugin provides a first line of defense against this practice, and it should be noted that this is not a bulletproof solution, since such thing could only be done by the CDM. Note that this plugin will only perform license checks taking into account the License's absolute expiration date, and not the play duration field.

Since:
  4.2.0

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final int`
  `DEFAULT_CHECK_INTERVAL_SEC`
  Default value for the time in between checks

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `DrmDeviceTimeCheckerPlugin()`
  Same as calling `DrmDeviceTimeCheckerPlugin(int)` with `DEFAULT_CHECK_INTERVAL_SEC`
  `DrmDeviceTimeCheckerPlugin(int checkIntervalSec)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `String`
  `getId()`
  `void`
  `init(Context context)`

  ### Methods inherited from class com.castlabs.android.Plugin

  `onRemotePlay`

  ### Methods inherited from class java.lang.Object

  `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### DEFAULT_CHECK_INTERVAL_SEC

    public static final int DEFAULT_CHECK_INTERVAL_SEC
    Default value for the time in between checks
    See Also:
      - Constant Field Values

- ## Constructor Details

  - ### DrmDeviceTimeCheckerPlugin

    public DrmDeviceTimeCheckerPlugin()
    Same as calling `DrmDeviceTimeCheckerPlugin(int)` with `DEFAULT_CHECK_INTERVAL_SEC`

  - ### DrmDeviceTimeCheckerPlugin

    public DrmDeviceTimeCheckerPlugin(int checkIntervalSec)
    Parameters:
      `checkIntervalSec` - How often will the check be performed

- ## Method Details

  - ### init

    public void init(Context context)
    Overrides:
      `init` in class `Plugin`

  - ### getId

    @NonNull public String getId()
    Specified by:
      `getId` in class `Plugin`