com.widevine.drmapi.android
Class WVPlayback

java.lang.Object
  extended by com.widevine.drmapi.android.WVPlayback

public class WVPlayback
extends java.lang.Object

The Widevine Android playback API supports playback of both local and remote (streamed) assets. Local assets are specified by their file path or a WVChunkedRandomAccessFile mechanism, while remote assets are specified by their HTTP or HTTPS URI. The library allow pre-fetching of licenses by registration and request license methods. These licenses will then be securely saved for later usage. Licenses then may be renewd by calling request license again or evaluated by calling the query methods. If licenses are not present, a license request will be issued at the beginning of playback. Playback is not delayed until the license is available, since most assets have a short initial, non-encrypted segment (normally 10 seconds). The license is normally received before this initial period is over, so there is no interruption in playback.

The play() method is used to initiate playback whether playing a local or remote asset. On return, play() provides a parameter which contains a URI that is passed directly to the MediaPlayer object.

Since:
1.0

Constructor Summary
WVPlayback()
           
 
Method Summary
static WVStatus deleteAssetDB(Context context)
          Deletes registration information and licenses for all assets.
 WVStatus initialize(Context context, java.util.HashMap<java.lang.String,java.lang.Object> settings, WVEventListener listener)
          Initialize the Widevine playback API.
 WVStatus initializeSynchronous(Context context, java.util.HashMap<java.lang.String,java.lang.Object> settings, WVEventListener listener)
          Initialize the Widevine playback API.
 boolean isRooted()
          Verifies whether the phone is rooted.
 void logDebugInfo()
           
 WVStatus nowOnline()
          Called when there is a network connection.
 WVStatus nowOnlineSynchronous()
          Called when there is a network connection.
 java.lang.String play(java.lang.String asset)
          Call to begin playback of an asset.
 java.lang.String play(java.lang.String asset, long fileSize)
          Call to begin playback of an asset.
 java.lang.String play(WVChunkedRandomAccessFile chunkedRandomAccessFile)
          Call to begin playback of an asset.
 WVStatus queryAssetsStatus()
          Iterate through all the assets checking their status.
 WVStatus queryAssetsStatusSynchronous()
          Iterate through all the assets checking their status.
 WVStatus queryAssetStatus(long systemId, long assetId, long keyId)
          Checks a single asset and returns its status.
 WVStatus queryAssetStatus(java.lang.String asset)
          Checks a single asset and returns its status.
 WVStatus queryAssetStatusSynchronous(long systemId, long assetId, long keyId)
          Checks a single asset and returns its status.
 WVStatus queryAssetStatusSynchronous(java.lang.String asset)
          Checks a single asset and returns its status.
 WVStatus registerAsset(java.lang.String asset)
          Registers an asset with the Widevine library.
 WVStatus registerAssetSynchronous(java.lang.String asset)
          Registers an asset with the Widevine library.
 WVStatus requestLicense(long systemId, long assetId, long keyId)
          This method requests the Widevine Library to retrieve a license for a specified system, asset and key ID.
 WVStatus requestLicense(java.lang.String asset)
          Allows retrival of a license for a single asset.
 WVStatus requestLicenseSynchronous(long systemId, long assetId, long keyId)
          This method requests the Widevine Library to retrieve a license for a specified system, asset and key ID.
 WVStatus requestLicenseSynchronous(java.lang.String asset)
          Allows retrival of a license for a single asset.
 java.lang.String secureRetrieve()
          Called when a string needs to be fetched from secure persistent storage.
 WVStatus secureStore(java.lang.String data)
          Called when a string needs to be saved to secure persistent storage.
 WVStatus setCredentials(java.util.HashMap<java.lang.String,java.lang.Object> settings)
          Configures parameters used during entitlement request and for local filesystem.
 WVStatus stop()
          Stop streaming the asset.
 WVStatus terminate()
          Terminate the Widevine API and release all resources.
 WVStatus terminateSynchronous()
          Terminate the Widevine API and release all resources.
 WVStatus unregisterAsset(java.lang.String asset)
          Unregisters an asset from the Widevine library.
 WVStatus unregisterAssetSynchronous(java.lang.String asset)
          Unregisters an asset from the Widevine library.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WVPlayback

public WVPlayback()
Method Detail

initialize

public WVStatus initialize(Context context,
                           java.util.HashMap<java.lang.String,java.lang.Object> settings,
                           WVEventListener listener)
Initialize the Widevine playback API. This method is asynchronous and will return immediately. A return code WVStatus.OK indicates in progress and that the activity is being processed on another thread. An event will be returned to the event listener when the activity completes. This method must be called before any other WV API methods except isRooted and deleteAssetDB.

Note: Always check the WVStatusKey value in the WVEvent.Initialized callback. A value of WVStatus.AssetDBWasCorrupted indicates that the asset database was corrupted, and had to be re-initialized. All asset information (registrations), and entitlements will be lost, and assets should be re-registered.

Parameters:
context - - The application context
settings - - name/value pairs for various settings. Refer to the Widevine Android API document for a description of the settings keys and values.
listener - - The WVEventListener object that receives event notifications.
Returns:
WVStatus.OK in progress (check event for success), WVStatus.AlreadyInitialized, if previously initialized

Events: WVEvent.Initialized (WVStatus.Ok) on success, WVEvent.InitializeFailed (WVStatus.AssetDBWasCorrupted) if the asset database was corrupted, WVEvent.InitializeFailed (WVStatus.TamperDetected) if a security check fails. This could result from a determination that the apk has been tampered with or is not correctly signed. Or if it is detected that the phone has been rooted. Check the WVErrorKey for additional details, WVEvent.InitializeFailed (WVStatus.HardwareIDAbsent) if required hardware identifiers cannot be queried though system calls, WVEvent.InitializeFailed (WVStatus.MandatorySettingsAbsent) if one of the mandatory attributes is not included, WVEvent.InitializeFailed (WVStatus.SystemCallError) if a JNI error occurs, WVEvent.InitializeFailed (WVStatus.OutOfMemory) if a memory allocation error occurs,


initializeSynchronous

public WVStatus initializeSynchronous(Context context,
                                      java.util.HashMap<java.lang.String,java.lang.Object> settings,
                                      WVEventListener listener)
Initialize the Widevine playback API. This method is a blocking call and may return an event to the event listener before the method returns. An event will only be returned if the method returns WVStatus.OK This method must be called before any other WV API methods except isRooted and deleteAssetDB.

Note: Always check the WVStatusKey value in the WVEvent.Initialized callback. A value of WVStatus.AssetDBWasCorrupted indicates that the asset database was corrupted, and had to be re-initialized. All asset information (registrations), and entitlements will be lost, and assets should be re-registered.

Parameters:
context - - The application context
settings - - name/value pairs for various settings. Refer to the Widevine Android API document for a description of the settings keys and values.
listener - - The WVEventListener object that receives event notifications.
Returns:
WVStatus.OK in progress (check event for success), WVStatus.AlreadyInitialized, if previously initialized

Events: WVEvent.Initialized (WVStatus.OK) on success, WVEvent.InitializeFailed (WVStatus.AssetDBWasCorrupted) if the asset database was corrupted, WVEvent.InitializeFailed (WVStatus.TamperDetected) if a security check fails. This could result from a determination that the apk has been tampered with or is not correctly signed. Or if it is detected that the phone has been rooted. Check the WVErrorKey for additional details, WVEvent.InitializeFailed (WVStatus.HardwareIDAbsent) if required hardware identifiers cannot be queried though system calls, WVEvent.InitializeFailed (WVStatus.MandatorySettingsAbsent) if one of the mandatory attributes is not included, WVEvent.InitializeFailed (WVStatus.SystemCallError) if a JNI error occurs, WVEvent.InitializeFailed (WVStatus.OutOfMemory) if a memory allocation error occurs,


terminate

public WVStatus terminate()
Terminate the Widevine API and release all resources. This method is asynchronous and will return immediately. A return code WVStatus.OK indicates in progress and that the activity is being processed on another thread. An event will be returned to the event listener when the activity completes. No other WV API functions may be called after calling terminate for this object.

Returns:
WVStatus.OK on success, WVStatus.NotInitialized, if not previously initialized

Events: WVEvent.Terminated (WVStatus.OK) in progress


terminateSynchronous

public WVStatus terminateSynchronous()
Terminate the Widevine API and release all resources. This method is a blocking call and may return an event to the event listener before the method returns. An event will only be returned if the method returns WVStatus.OK No other WV API functions may be called after calling terminate for this object.

Returns:
WVStatus.OK on success, WVStatus.NotInitialized, if not previously initialized

Events: WVEvent.Terminated (WVStatus.OK) in progress


setCredentials

public WVStatus setCredentials(java.util.HashMap<java.lang.String,java.lang.Object> settings)
Configures parameters used during entitlement request and for local filesystem. This method has to be called at least once and may be called multiple times. It should be used to update parameters between playback attempts.

Parameters:
settings - - name/value pairs for various settings. Refer to the Widevine Android API document for a description of the settings keys and values.
Returns:
WVStatus.OK on success WVStatus.MandatorySettingsAbsent if one of the mandatory attributes is not included, WVStatus.AssetDBWasCorrupted if the asset database was corrupted, WVStatus.SystemCallError if a JNI error occurs, WVStatus.OutOfMemory if a memory allocation error occurs,

Events: None


registerAsset

public WVStatus registerAsset(java.lang.String asset)
Registers an asset with the Widevine library. This method is asynchronous and will return immediately. A return code WVStatus.OK indicates in progress and that the activity is being processed on another thread. An event will be returned to the event listener when the activity completes. This function does not transfer ownership of the asset file; it is the responsibility of the caller to keep the actual file. The caller should call nowOnline or requestLicense method if a license is to be stored. An attempt to register a previously registered asset, without an intervening unregisterAsset call will result in WVStatus.AlreadyRegistered being returned.

Parameters:
asset - One of: The path to the file containing a local asset OR the HTTP or HTTPS URL of a remote asset.
Returns:
WVStatus.OK in progress (check event for success), WVStatus.NotInitialized, if API has not been previously successfully initialized, WVStatus.SystemCallError, if the command could not be executed.

Events: WVEvent.Registered (WVStatus.OK), WVEvent.Registered (WVStatus.OutOfMemoryError), WVEvent.Registered (WVStatus.FileSystemError), WVEvent.Registered (WVStatus.ClockTamperDetected), WVEvent.Registered (WVStatus.AlreadyRegistered),


registerAssetSynchronous

public WVStatus registerAssetSynchronous(java.lang.String asset)
Registers an asset with the Widevine library. This method is a blocking call and may return an event to the event listener before the method returns. An event will only be returned if the method returns WVStatus.OK This function does not transfer ownership of the asset file; it is the responsibility of the caller to keep the actual file. The caller should call nowOnline or requestLicense method if a license is to be stored. An attempt to register a previously registered asset, without an intervening unregisterAsset call will result in WVStatus.AlreadyRegistered being returned.

Parameters:
asset - One of: The path to the file containing a local asset OR the HTTP or HTTPS URL of a remote asset.
Returns:
WVStatus.OK in progress (check event for success), WVStatus.NotInitialized, if API has not been previously successfully initialized, WVStatus.SystemCallError, if the command could not be executed.

Events: WVEvent.Registered (WVStatus.OK), WVEvent.Registered (WVStatus.OutOfMemoryError), WVEvent.Registered (WVStatus.FileSystemError), WVEvent.Registered (WVStatus.ClockTamperDetected), WVEvent.Registered (WVStatus.AlreadyRegistered),


unregisterAsset

public WVStatus unregisterAsset(java.lang.String asset)
Unregisters an asset from the Widevine library. This method is asynchronous and will return immediately. A return code WVStatus.OK indicates in progress and that the activity is being processed on another thread. An event will be returned to the event listener when the activity completes. All information related to the file, including entitlements, is removed from the device

Parameters:
asset - One of: the path to the file containing a local asset OR the HTTP or HTTPS URL of a remote asset.
Returns:
WVStatus.OK in progress (check event for success), WVStatus.NotInitialized, if API has not been previously successfully initialized,

Events: WVEvent.Unregistered (WVStatus.OK), WVEvent.Unregistered (WVStatus.ClockTamperDetected), WVEvent.Unregistered (WVStatus.OutOfMemoryError), WVEvent.Unregistered (WVStatus.SystemCallError), WVEvent.Unregistered (WVStatus.PendingServerNotification),


unregisterAssetSynchronous

public WVStatus unregisterAssetSynchronous(java.lang.String asset)
Unregisters an asset from the Widevine library. This method is a blocking call and may return an event to the event listener before the method returns. An event will only be returned if the method returns WVStatus.OK All information related to the file, including entitlements, is removed from the device

Parameters:
asset - One of: the path to the file containing a local asset OR the HTTP or HTTPS URL of a remote asset.
Returns:
WVStatus.OK in progress (check event for success), WVStatus.NotInitialized, if API has not been previously successfully initialized,

Events: WVEvent.Unregistered (WVStatus.OK), WVEvent.Unregistered (WVStatus.ClockTamperDetected), WVEvent.Unregistered (WVStatus.OutOfMemoryError), WVEvent.Unregistered (WVStatus.SystemCallError), WVEvent.Unregistered (WVStatus.PendingServerNotification),


queryAssetsStatus

public WVStatus queryAssetsStatus()
Iterate through all the assets checking their status. This method is asynchronous and will return immediately. A return code WVStatus.OK indicates in progress and that the activity is being processed on another thread. An event will be returned to the event listener when the activity completes. This may be used on startup to check which assets have licenses and which ones still need to get a license. Each asset calls the listener to give its status. Once all assets have been reported, the event listener is invoked with WVEvent.EndOfList.

Returns:
WVStatus.OK in progress (check event for success), WVStatus.NotInitialized, if API has not been previously successfully initialized,

Events: WVEvent.QueryStatus (WVStatus.OK), WVEvent.QueryStatus (WVStatus.OutOfMemoryError), WVEvent.QueryStatus (WVStatus.ClockTamperDetect), WVEvent.QueryStatus (WVStatus.NotRegistered), WVEvent.QueryStatus (WVStatus.NotLicensed), WVEvent.QueryStatus (WVStatus.LicensedDenied), WVEvent.QueryStatus (WVStatus.LicensedExpired), WVEvent.QueryStatus (WVStatus.SystemCallError), WVEvent.EndOfList (WVStatus.OK),


queryAssetsStatusSynchronous

public WVStatus queryAssetsStatusSynchronous()
Iterate through all the assets checking their status. This method is a blocking call and may return an event to the event listener before the method returns. An event will only be returned if the method returns WVStatus.OK This may be used on startup to check which assets have licenses and which ones still need to get a license. Each asset calls the listener to give its status. Once all assets have been reported, the event listener is invoked with WVEvent.EndOfList.

Returns:
WVStatus.OK in progress (check event for success), WVStatus.NotInitialized, if API has not been previously successfully initialized,

Events: WVEvent.QueryStatus (WVStatus.OK), WVEvent.QueryStatus (WVStatus.OutOfMemoryError), WVEvent.QueryStatus (WVStatus.ClockTamperDetect), WVEvent.QueryStatus (WVStatus.NotRegistered), WVEvent.QueryStatus (WVStatus.NotLicensed), WVEvent.QueryStatus (WVStatus.LicensedDenied), WVEvent.QueryStatus (WVStatus.LicensedExpired), WVEvent.QueryStatus (WVStatus.SystemCallError), WVEvent.EndOfList (WVStatus.OK),


queryAssetStatus

public WVStatus queryAssetStatus(java.lang.String asset)
Checks a single asset and returns its status. This method is asynchronous and will return immediately. A return code WVStatus.OK indicates in progress and that the activity is being processed on another thread. An event will be returned to the event listener when the activity completes.

Parameters:
asset - One of: The path to the file containing a local asset OR The HTTP or HTTPS URL of a remote asset.
Returns:
WVStatus.OK in progress (check event for success), WVStatus.NotInitialized, if API has not been previously successfully initialized,

Events: WVEvent.QueryStatus (WVStatus.OK), WVEvent.QueryStatus (WVStatus.OutOfMemoryError), WVEvent.QueryStatus (WVStatus.ClockTamperDetect), WVEvent.QueryStatus (WVStatus.NotRegistered), WVEvent.QueryStatus (WVStatus.NotLicensed), WVEvent.QueryStatus (WVStatus.LicensedDenied), WVEvent.QueryStatus (WVStatus.LicensedExpired), WVEvent.QueryStatus (WVStatus.SystemCallError),


queryAssetStatusSynchronous

public WVStatus queryAssetStatusSynchronous(java.lang.String asset)
Checks a single asset and returns its status. This method is a blocking call and may return an event to the event listener before the method returns. An event will only be returned if the method returns WVStatus.OK

Parameters:
asset - One of: The path to the file containing a local asset OR The HTTP or HTTPS URL of a remote asset.
Returns:
WVStatus.OK in progress (check event for success), WVStatus.NotInitialized, if API has not been previously successfully initialized,

Events: WVEvent.QueryStatus (WVStatus.OK), WVEvent.QueryStatus (WVStatus.OutOfMemoryError), WVEvent.QueryStatus (WVStatus.ClockTamperDetect), WVEvent.QueryStatus (WVStatus.NotRegistered), WVEvent.QueryStatus (WVStatus.NotLicensed), WVEvent.QueryStatus (WVStatus.LicensedDenied), WVEvent.QueryStatus (WVStatus.LicensedExpired), WVEvent.QueryStatus (WVStatus.SystemCallError),


queryAssetStatus

public WVStatus queryAssetStatus(long systemId,
                                 long assetId,
                                 long keyId)
Checks a single asset and returns its status. This method is asynchronous and will return immediately. A return code WVStatus.OK indicates in progress and that the activity is being processed on another thread. An event will be returned to the event listener when the activity completes.

Parameters:
systemId - the system ID used to identify the asset provider
assetId - the asset ID used to identify the asset
keyId - the key ID used to identify the asset key
Returns:
WVStatus.OK in progress (check event for success), WVStatus.NotInitialized, if API has not been previously successfully initialized,

Events: WVEvent.QueryStatus (WVStatus.OK), WVEvent.QueryStatus (WVStatus.OutOfMemoryError), WVEvent.QueryStatus (WVStatus.ClockTamperDetect), WVEvent.QueryStatus (WVStatus.NotRegistered), WVEvent.QueryStatus (WVStatus.NotLicensed), WVEvent.QueryStatus (WVStatus.LicensedDenied), WVEvent.QueryStatus (WVStatus.LicensedExpired), WVEvent.QueryStatus (WVStatus.SystemCallError),


queryAssetStatusSynchronous

public WVStatus queryAssetStatusSynchronous(long systemId,
                                            long assetId,
                                            long keyId)
Checks a single asset and returns its status. This method is a blocking call and may return an event to the event listener before the method returns. An event will only be returned if the method returns WVStatus.OK

Parameters:
systemId - the system ID used to identify the asset provider
assetId - the asset ID used to identify the asset
keyId - the key ID used to identify the asset key
Returns:
WVStatus.OK in progress (check event for success), WVStatus.NotInitialized, if API has not been previously successfully initialized,

Events: WVEvent.QueryStatus (WVStatus.OK), WVEvent.QueryStatus (WVStatus.OutOfMemoryError), WVEvent.QueryStatus (WVStatus.ClockTamperDetect), WVEvent.QueryStatus (WVStatus.NotRegistered), WVEvent.QueryStatus (WVStatus.NotLicensed), WVEvent.QueryStatus (WVStatus.LicensedDenied), WVEvent.QueryStatus (WVStatus.LicensedExpired), WVEvent.QueryStatus (WVStatus.SystemCallError),


nowOnline

public WVStatus nowOnline()
Called when there is a network connection. This method is asynchronous and will return immediately. A return code WVStatus.OK indicates in progress and that the activity is being processed on another thread. An event will be returned to the event listener when the activity completes. This allows the Widevine Library to retrieve licenses for all registered assets. The event listener will be called once for each asset that needs a license.

Returns:
WVStatus.OK in progress (check event for success), WVStatus.NotInitialized, if API has not been previously successfully initialized,

Events: WVEvent.LicenseReceived (WVStatus.OK), WVEvent.LicenseRequestFailed (WVStatus.BadUrl), WVEvent.LicenseRequestFailed (WVStatus.CantConnectToMediaServer), WVEvent.LicenseRequestFailed (WVStatus.LostConnection), WVEvent.LicenseRequestFailed (WVStatus.BadMedia), WVEvent.LicenseRequestFailed (WVStatus.FileNotPresent), WVEvent.LicenseRequestFailed (WVStatus.SystemCallError), WVEvent.LicenseRequestFailed (WVStatus.OutOfMemory), WVEvent.LicenseRequestFailed (WVStatus.CantConnectToDrmServer), WVEvent.LicenseRequestFailed (WVStatus.LicenseDenied), WVEvent.LicenseRequestFailed (WVStatus.NotLicensed), WVEvent.LicenseRequestFailed (WVStatus.ClockTamperDetected), WVEvent.LicenseRequestFailed (WVStatus.FileSystemError), WVEvent.LicenseRequestFailed (WVStatus.LicenseExpired),


nowOnlineSynchronous

public WVStatus nowOnlineSynchronous()
Called when there is a network connection. This method is a blocking call and may return an event to the event listener before the method returns. An event will only be returned if the method returns WVStatus.OK This allows the Widevine Library to retrieve licenses for all registered assets. The event listener will be called once for each asset that needs a license.

Returns:
WVStatus.OK in progress (check event for success), WVStatus.NotInitialized, if API has not been previously successfully initialized,

Events: WVEvent.LicenseReceived (WVStatus.OK), WVEvent.LicenseRequestFailed (WVStatus.BadUrl), WVEvent.LicenseRequestFailed (WVStatus.CantConnectToMediaServer), WVEvent.LicenseRequestFailed (WVStatus.LostConnection), WVEvent.LicenseRequestFailed (WVStatus.BadMedia), WVEvent.LicenseRequestFailed (WVStatus.FileNotPresent), WVEvent.LicenseRequestFailed (WVStatus.SystemCallError), WVEvent.LicenseRequestFailed (WVStatus.OutOfMemory), WVEvent.LicenseRequestFailed (WVStatus.CantConnectToDrmServer), WVEvent.LicenseRequestFailed (WVStatus.LicenseDenied), WVEvent.LicenseRequestFailed (WVStatus.NotLicensed), WVEvent.LicenseRequestFailed (WVStatus.ClockTamperDetected), WVEvent.LicenseRequestFailed (WVStatus.FileSystemError), WVEvent.LicenseRequestFailed (WVStatus.LicenseExpired),


requestLicense

public WVStatus requestLicense(java.lang.String asset)
Allows retrival of a license for a single asset. This method is asynchronous and will return immediately. A return code WVStatus.OK indicates in progress and that the activity is being processed on another thread. An event will be returned to the event listener when the activity completes.

Parameters:
asset - One of: The path to the file containing a local asset OR The HTTP or HTTPS URL of a remote asset.
Returns:
WVStatus.OK in progress (check event for success), WVStatus.NotInitialized, if API has not been previously successfully initialized,

Events: WVEvent.LicenseReceived (WVStatus.OK), WVEvent.LicenseRequestFailed (WVStatus.BadUrl), WVEvent.LicenseRequestFailed (WVStatus.CantConnectToMediaServer), WVEvent.LicenseRequestFailed (WVStatus.LostConnection), WVEvent.LicenseRequestFailed (WVStatus.BadMedia), WVEvent.LicenseRequestFailed (WVStatus.FileNotPresent), WVEvent.LicenseRequestFailed (WVStatus.SystemCallError), WVEvent.LicenseRequestFailed (WVStatus.OutOfMemory), WVEvent.LicenseRequestFailed (WVStatus.CantConnectToDrmServer), WVEvent.LicenseRequestFailed (WVStatus.LicenseDenied), WVEvent.LicenseRequestFailed (WVStatus.NotLicensed), WVEvent.LicenseRequestFailed (WVStatus.ClockTamperDetected), WVEvent.LicenseRequestFailed (WVStatus.FileSystemError), WVEvent.LicenseRequestFailed (WVStatus.LicenseExpired),


requestLicenseSynchronous

public WVStatus requestLicenseSynchronous(java.lang.String asset)
Allows retrival of a license for a single asset. This method is a blocking call and may return an event to the event listener before the method returns. An event will only be returned if the method returns WVStatus.OK

Parameters:
asset - One of: The path to the file containing a local asset OR The HTTP or HTTPS URL of a remote asset.
Returns:
WVStatus.OK in progress (check event for success), WVStatus.NotInitialized, if API has not been previously successfully initialized,

Events: WVEvent.LicenseReceived (WVStatus.OK), WVEvent.LicenseRequestFailed (WVStatus.BadUrl), WVEvent.LicenseRequestFailed (WVStatus.CantConnectToMediaServer), WVEvent.LicenseRequestFailed (WVStatus.LostConnection), WVEvent.LicenseRequestFailed (WVStatus.BadMedia), WVEvent.LicenseRequestFailed (WVStatus.FileNotPresent), WVEvent.LicenseRequestFailed (WVStatus.SystemCallError), WVEvent.LicenseRequestFailed (WVStatus.OutOfMemory), WVEvent.LicenseRequestFailed (WVStatus.CantConnectToDrmServer), WVEvent.LicenseRequestFailed (WVStatus.LicenseDenied), WVEvent.LicenseRequestFailed (WVStatus.NotLicensed), WVEvent.LicenseRequestFailed (WVStatus.ClockTamperDetected), WVEvent.LicenseRequestFailed (WVStatus.FileSystemError), WVEvent.LicenseRequestFailed (WVStatus.LicenseExpired),


requestLicense

public WVStatus requestLicense(long systemId,
                               long assetId,
                               long keyId)
This method requests the Widevine Library to retrieve a license for a specified system, asset and key ID. This method is asynchronous and will return immediately. A return code WVStatus.OK indicates in progress and that the activity is being processed on another thread. An event will be returned to the event listener when the activity completes. An event will be generated to indicate the result of this command and indicate whether a license was successfully acquired.

Returns:
WVStatus.OK in progress (check event for success), WVStatus.NotInitialized, if API has not been previously successfully initialized,

Events: WVEvent.LicenseReceived (WVStatus.OK), WVEvent.LicenseRequestFailed (WVStatus.LostConnection), WVEvent.LicenseRequestFailed (WVStatus.SystemCallError), WVEvent.LicenseRequestFailed (WVStatus.OutOfMemory), WVEvent.LicenseRequestFailed (WVStatus.CantConnectToDrmServer), WVEvent.LicenseRequestFailed (WVStatus.LicenseDenied), WVEvent.LicenseRequestFailed (WVStatus.NotLicensed), WVEvent.LicenseRequestFailed (WVStatus.ClockTamperDetected), WVEvent.LicenseRequestFailed (WVStatus.FileSystemError), WVEvent.LicenseRequestFailed (WVStatus.LicenseExpired),


requestLicenseSynchronous

public WVStatus requestLicenseSynchronous(long systemId,
                                          long assetId,
                                          long keyId)
This method requests the Widevine Library to retrieve a license for a specified system, asset and key ID. This method is blocking and may return an event to the event listener before the method returns. An event will only be returned if the method returns WVStatus.OK An event will be generated to indicate the result of this command and indicate whether a license was successfully acquired.

Returns:
WVStatus.OK in progress (check event for success), WVStatus.NotInitialized, if API has not been previously successfully initialized,

Events: WVEvent.LicenseReceived (WVStatus.OK), WVEvent.LicenseRequestFailed (WVStatus.LostConnection), WVEvent.LicenseRequestFailed (WVStatus.SystemCallError), WVEvent.LicenseRequestFailed (WVStatus.OutOfMemory), WVEvent.LicenseRequestFailed (WVStatus.CantConnectToDrmServer), WVEvent.LicenseRequestFailed (WVStatus.LicenseDenied), WVEvent.LicenseRequestFailed (WVStatus.NotLicensed), WVEvent.LicenseRequestFailed (WVStatus.ClockTamperDetected), WVEvent.LicenseRequestFailed (WVStatus.FileSystemError), WVEvent.LicenseRequestFailed (WVStatus.LicenseExpired),


play

public java.lang.String play(java.lang.String asset,
                             long fileSize)
Call to begin playback of an asset. The returned url contains the url that needs to be passed to the MediaPlayer. This method should be called when playing back clear local content and when the file has only been partially downloaded. Only one asset may be played at a time. If a license is not present a license request will be issued. If the asset policy is configued as such, a license may be requested even if one is stored offline. If the license request ends in an error other than revocation, the locally stored license will be used.

Parameters:
asset - One of: The path to the file containing a local asset OR The HTTP or HTTPS URL of a remote asset.
Returns:
The url to pass to the MediaPlayer on success, otherwise null.

Events: WVEvent.Playing (WVStatus.OK) on success WVEvent.PlayFailed (WVStatus.NotInitialized) if API has not been previously successfully initialized. WVEvent.PlayFailed (WVStatus.CantConnectToMediaServer) if content is inaccessible, WVEvent.PlayFailed (WVStatus.SystemCallError) if an error occurs while loading shared library, WVEvent.PlayFailed (WVStatus.FileNotPresent) if content is inaccesible.


play

public java.lang.String play(java.lang.String asset)
Call to begin playback of an asset. The returned url contains the url that needs to be passed to the MediaPlayer. This is the default play method and should be called unless playing back a chunked random access file or a partially downloaded local clear file. Only one asset may be played at a time. If a license is not present a license request will be issued. If the asset policy is configued as such, a license may be requested even if one is stored offline. If the license request ends in an error other than revocation, the locally stored license will be used.

Parameters:
asset - One of: The path to the file containing a local asset OR The HTTP or HTTPS URL of a remote asset.
Returns:
The url to pass to the MediaPlayer on success, otherwise null.

Events: WVEvent.Playing (WVStatus.OK) on success WVEvent.PlayFailed (WVStatus.NotInitialized) if API has not been previously successfully initialized. WVEvent.PlayFailed (WVStatus.CantConnectToMediaServer) if content is inaccessible, WVEvent.PlayFailed (WVStatus.SystemCallError) if an error occurs while loading shared library, WVEvent.PlayFailed (WVStatus.FileNotPresent) if content is inaccesible.


play

public java.lang.String play(WVChunkedRandomAccessFile chunkedRandomAccessFile)
Call to begin playback of an asset. The returned url contains the url that needs to be passed to the MediaPlayer. This play method should be called when attempting to playback a chunked random access file. Only one asset may be played at a time. If a license is not present a license request will be issued. If the asset policy is configued as such, a license may be requested even if one is stored offline. If the license request ends in an error other than revocation, the locally stored license will be used.

Parameters:
asset - One of: The path to the file containing a local asset OR The HTTP or HTTPS URL of a remote asset.
Returns:
The url to pass to the MediaPlayer on success, otherwise null.

Events: WVEvent.Playing (WVStatus.OK) on success WVEvent.PlayFailed (WVStatus.NotInitialized) if API has not been previously successfully initialized. WVEvent.PlayFailed (WVStatus.CantConnectToMediaServer) if content is inaccessible, WVEvent.PlayFailed (WVStatus.SystemCallError) if an error occurs while loading shared library,


stop

public WVStatus stop()
Stop streaming the asset.

Returns:
WVStatus.OK on success, otherwise one of the WVStatus values indicating the specific error

Events: WVEvent.Stopped


secureStore

public WVStatus secureStore(java.lang.String data)
Called when a string needs to be saved to secure persistent storage. If a value has been previously set, it will be overwritten. This should only be called after setCredentials has been called.

Returns:
WVStatus.OK on success, otherwise one of the WVStatus values indicating the specific error

secureRetrieve

public java.lang.String secureRetrieve()
Called when a string needs to be fetched from secure persistent storage. This should only be called after setCredentials has been called.

Returns:
the stored value on success, otherwise an empty string will be returned if an error occurs or no value has previously been set.

isRooted

public boolean isRooted()
Verifies whether the phone is rooted. It is safe to call this method before initializing the API.

Returns:
true if the phone is rooted, false otherwise.

Events: None


deleteAssetDB

public static WVStatus deleteAssetDB(Context context)
Deletes registration information and licenses for all assets. This method is static and no WVPlayback objects should be in use when this method is called.

Parameters:
context - The application context if no Asset DB path has specified when WVPlayback was previously initialized

Events: None


logDebugInfo

public void logDebugInfo()