com.widevine.drmapi.android
public class WVPlayback extends java.lang.Object
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.
Constructor and Description |
---|
WVPlayback() |
Modifier and Type | Method and Description |
---|---|
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.
|
public WVStatus initialize(Context context, java.util.HashMap<java.lang.String,java.lang.Object> settings, WVEventListener listener)
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.
context
- - The application contextsettings
- - 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.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,
public WVStatus initializeSynchronous(Context context, java.util.HashMap<java.lang.String,java.lang.Object> settings, WVEventListener listener)
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.
context
- - The application contextsettings
- - 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.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,
public WVStatus terminate()
Events: WVEvent.Terminated (WVStatus.OK) in progress
public WVStatus terminateSynchronous()
Events: WVEvent.Terminated (WVStatus.OK) in progress
public WVStatus setCredentials(java.util.HashMap<java.lang.String,java.lang.Object> settings)
settings
- - name/value pairs for various settings.
Refer to the Widevine Android API document for a description of
the settings keys and values.Events: None
public WVStatus registerAsset(java.lang.String asset)
asset
- One of: The path to the file containing a local asset OR
the HTTP or HTTPS URL of a remote asset.Events: WVEvent.Registered (WVStatus.OK), WVEvent.Registered (WVStatus.OutOfMemoryError), WVEvent.Registered (WVStatus.FileSystemError), WVEvent.Registered (WVStatus.ClockTamperDetected), WVEvent.Registered (WVStatus.AlreadyRegistered),
public WVStatus registerAssetSynchronous(java.lang.String asset)
asset
- One of: The path to the file containing a local asset OR
the HTTP or HTTPS URL of a remote asset.Events: WVEvent.Registered (WVStatus.OK), WVEvent.Registered (WVStatus.OutOfMemoryError), WVEvent.Registered (WVStatus.FileSystemError), WVEvent.Registered (WVStatus.ClockTamperDetected), WVEvent.Registered (WVStatus.AlreadyRegistered),
public WVStatus unregisterAsset(java.lang.String asset)
asset
- One of: the path to the file containing a local asset OR
the HTTP or HTTPS URL of a remote asset.Events: WVEvent.Unregistered (WVStatus.OK), WVEvent.Unregistered (WVStatus.ClockTamperDetected), WVEvent.Unregistered (WVStatus.OutOfMemoryError), WVEvent.Unregistered (WVStatus.SystemCallError), WVEvent.Unregistered (WVStatus.PendingServerNotification),
public WVStatus unregisterAssetSynchronous(java.lang.String asset)
asset
- One of: the path to the file containing a local asset OR
the HTTP or HTTPS URL of a remote asset.Events: WVEvent.Unregistered (WVStatus.OK), WVEvent.Unregistered (WVStatus.ClockTamperDetected), WVEvent.Unregistered (WVStatus.OutOfMemoryError), WVEvent.Unregistered (WVStatus.SystemCallError), WVEvent.Unregistered (WVStatus.PendingServerNotification),
public WVStatus queryAssetsStatus()
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),
public WVStatus queryAssetsStatusSynchronous()
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),
public WVStatus queryAssetStatus(java.lang.String asset)
asset
- One of: The path to the file containing a local asset OR
The HTTP or HTTPS URL of a remote asset.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),
public WVStatus queryAssetStatusSynchronous(java.lang.String asset)
asset
- One of: The path to the file containing a local asset OR
The HTTP or HTTPS URL of a remote asset.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),
public WVStatus queryAssetStatus(long systemId, long assetId, long keyId)
systemId
- the system ID used to identify the asset providerassetId
- the asset ID used to identify the assetkeyId
- the key ID used to identify the asset keyEvents: 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),
public WVStatus queryAssetStatusSynchronous(long systemId, long assetId, long keyId)
systemId
- the system ID used to identify the asset providerassetId
- the asset ID used to identify the assetkeyId
- the key ID used to identify the asset keyEvents: 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),
public WVStatus nowOnline()
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),
public WVStatus nowOnlineSynchronous()
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),
public WVStatus requestLicense(java.lang.String asset)
asset
- One of: The path to the file containing a local asset OR
The HTTP or HTTPS URL of a remote asset.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),
public WVStatus requestLicenseSynchronous(java.lang.String asset)
asset
- One of: The path to the file containing a local asset OR
The HTTP or HTTPS URL of a remote asset.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),
public WVStatus requestLicense(long systemId, long assetId, long keyId)
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),
public WVStatus requestLicenseSynchronous(long systemId, long assetId, long keyId)
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),
public java.lang.String play(java.lang.String asset, long fileSize)
asset
- One of: The path to the file containing a local asset OR
The HTTP or HTTPS URL of a remote asset.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.
public java.lang.String play(java.lang.String asset)
asset
- One of: The path to the file containing a local asset OR
The HTTP or HTTPS URL of a remote asset.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.
public java.lang.String play(WVChunkedRandomAccessFile chunkedRandomAccessFile)
asset
- One of: The path to the file containing a local asset OR
The HTTP or HTTPS URL of a remote asset.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,
public WVStatus stop()
Events: WVEvent.Stopped
public WVStatus secureStore(java.lang.String data)
public java.lang.String secureRetrieve()
public boolean isRooted()
Events: None
public static WVStatus deleteAssetDB(Context context)
context
- The application context if no Asset DB path has specified
when WVPlayback was previously initialized
Events: None
public void logDebugInfo()