Class 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.

    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 Detail

      • 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 Detail

      • DrmDeviceTimeCheckerPlugin

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