com.adobe.ave.drm
Class DRMManager

java.lang.Object
  extended by com.adobe.ave.drm.DRMManager

public class DRMManager
extends java.lang.Object

The DRMManager manages the retrieval and storage of the licenses needed to view DRM-protected content.

With the static DRMManager.getDRMManager() method, you can access the existing DRMManager object to perform the following DRM-management tasks:

No method is provided for enumerating all the licenses in the local cache.


Field Summary
protected  long peerObject
           
 
Method Summary
 void acquireLicense(DRMMetadata contentData, DRMAcquireLicenseSettings setting, DRMOperationErrorCallback error, DRMLicenseAcquiredCallback acquired)
          Loads a license from a media rights server or the local license cache.
 void acquirePreviewLicense(DRMMetadata contentData, DRMOperationErrorCallback error, DRMLicenseAcquiredCallback acquired)
          Gets a preview license from the license server, which you can use to let a user verify that they can play content on particular computer.
 void authenticate(DRMMetadata metadata, java.lang.String url, java.lang.String authenticationDomain, java.lang.String user, java.lang.String password, DRMOperationErrorCallback error, DRMAuthenticationCompleteCallback complete)
          Authenticates a user.
 DRMMetadata createMetadataFromBytes(byte[] bytes, DRMOperationErrorCallback error)
           
 long getMaxOperationTime()
           
static DRMManager getSharedManager(Context context)
          Returns the singleton DRMManager instance
 void initialize(DRMOperationErrorCallback error, DRMOperationCompleteCallback complete)
          Precomputes anything that can be precomputed so that future playback will have the shortest delay possible.
 void joinLicenseDomain(DRMLicenseDomain licenseDomain, boolean forceRefresh, DRMOperationErrorCallback error, DRMOperationCompleteCallback complete)
           
 void leaveLicenseDomain(DRMLicenseDomain licenseDomain, DRMOperationErrorCallback error, DRMOperationCompleteCallback complete)
           
 void resetDRM(DRMOperationErrorCallback error, DRMOperationCompleteCallback complete)
          Deletes all locally cached digital rights management (DRM) license data.
 void returnLicense(java.lang.String serverURL, java.lang.String licenseID, java.lang.String policyID, boolean commitImmediately, DRMOperationErrorCallback error, DRMLicenseReturnCompleteCallback complete)
          Returns the policies associated with a licenseID or a policy of a particular licenseID
 void setAuthenticationToken(DRMMetadata metadata, java.lang.String authenticationDomain, byte[] token, DRMOperationErrorCallback error, DRMOperationCompleteCallback complete)
          Sets the authentication token to use for communication with the specified server and domain.
 void setMaxOperationTime(long maxOperationTime)
           
 void setMaxOperationTimeNative(long maxOperationTime)
           
 void storeLicenseBytes(byte[] licenseBytes, DRMOperationErrorCallback error, DRMOperationCompleteCallback complete)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

peerObject

protected long peerObject
Method Detail

getSharedManager

public static DRMManager getSharedManager(Context context)
Returns the singleton DRMManager instance


initialize

public void initialize(DRMOperationErrorCallback error,
                       DRMOperationCompleteCallback complete)
Precomputes anything that can be precomputed so that future playback will have the shortest delay possible.

Call this method as early as possible in your application. Ideally, call this at a time that the user believes that the application is waiting for him (e.g. to pick what content to watch), so that he does not realize that he can't actually watch content yet because he would need to wait for the application.


createMetadataFromBytes

public DRMMetadata createMetadataFromBytes(byte[] bytes,
                                           DRMOperationErrorCallback error)

getMaxOperationTime

public long getMaxOperationTime()

setMaxOperationTime

public void setMaxOperationTime(long maxOperationTime)

setMaxOperationTimeNative

public void setMaxOperationTimeNative(long maxOperationTime)

setAuthenticationToken

public void setAuthenticationToken(DRMMetadata metadata,
                                   java.lang.String authenticationDomain,
                                   byte[] token,
                                   DRMOperationErrorCallback error,
                                   DRMOperationCompleteCallback complete)
Sets the authentication token to use for communication with the specified server and domain. Authentication tokens are available from the DRMAuthenticationCompleteCallback called after a successful call to the authenticate() method. The token is cached automatically for the session, but you can use the setAuthenticationToken() method to manage tokens directly.

Setting a token overwrites any existing cached token for the server and domain. Set the token parameter to null to clear the cached token.

Parameters:
metadata - The metadata of the content (the URL of the authentication server will be found from this metadata)
authenticationDomain - The domain on the media rights server
token - The authentication token

authenticate

public void authenticate(DRMMetadata metadata,
                         java.lang.String url,
                         java.lang.String authenticationDomain,
                         java.lang.String user,
                         java.lang.String password,
                         DRMOperationErrorCallback error,
                         DRMAuthenticationCompleteCallback complete)
Authenticates a user.

Listen for the authenticationComplete and authenticationError events to determine the outcome of the authentication attempt. Multiple authenticate() calls are queued. The DRMAuthenticationCompleteCallback callback provided will be called with an authentication token that your application can save.

You can use a saved authentication token, or a token downloaded by another means, to establish an authenticated session with the media rights server in the future. To establish a session using a token, call the DRMManager setAuthenticationToken() method. The properties of the token, such as expiration date, are determined by the settings of the server that generates the token.

Parameters:
serverURL:String - The URL of a media rights server that can provide a voucher for viewing protected content
metadata - the metadata of the content
url - the url to the authentication server
authenticationDomain - A domain on the server (not a network or Internet domain name)
user - the user name
password - the user's password

acquirePreviewLicense

public void acquirePreviewLicense(DRMMetadata contentData,
                                  DRMOperationErrorCallback error,
                                  DRMLicenseAcquiredCallback acquired)
Gets a preview license from the license server, which you can use to let a user verify that they can play content on particular computer. This capability lets users verify that they can play content on their computer before buying and downloading the content. It is useful when the user's computer doesn't have the necessary output protection capabilities or necessary software to play content.

Like acquireLicense(), this method is an asynchronous call and calls the DRMLicenseAcquiredCallback on completion or a DRMOperationErrorCallback in case of errors.


acquireLicense

public void acquireLicense(DRMMetadata contentData,
                           DRMAcquireLicenseSettings setting,
                           DRMOperationErrorCallback error,
                           DRMLicenseAcquiredCallback acquired)
Loads a license from a media rights server or the local license cache.

The license is loaded according to the setting parameter:

When the license is successfully loaded, the DRMLicenseAcquiredCallback is called. Your application can begin playback as soon as the license is loaded. The license will be passed to your callback. You can use this license object to display the associated media rights information to the user.

If a license cannot be loaded from the media rights server, the DRMOperationErrorCallback is dispatched. The errorID property of the dispatched DRMErrorEvent object indicates the reason for the failure. Common causes of failure include attempting to connect to the media rights server when the user is offline and attempting to load a license when the user is not logged in. Your application can respond to these errors and take corrective action. For example, if authentication credentials are required to download the license, you can prompt the user for their account user name and password, call the DRMManager authenticate() method, and then attempt to load the license again.

If a license cannot be obtained from the local cache and the localOnly setting is used, the DRMOperationErrorCallback is not called. Instead, the DRMLicenseAcquiredCallback is called, but the license is null.

Parameters:
contentData - The DRMMetadata object from a DRM-protected media file
setting - Determines whether the license is retrieved from the local cache or the media rights server

storeLicenseBytes

public void storeLicenseBytes(byte[] licenseBytes,
                              DRMOperationErrorCallback error,
                              DRMOperationCompleteCallback complete)

resetDRM

public void resetDRM(DRMOperationErrorCallback error,
                     DRMOperationCompleteCallback complete)
Deletes all locally cached digital rights management (DRM) license data.

The application must download the required licenses again for the user to be able to access encrypted content.


returnLicense

public void returnLicense(java.lang.String serverURL,
                          java.lang.String licenseID,
                          java.lang.String policyID,
                          boolean commitImmediately,
                          DRMOperationErrorCallback error,
                          DRMLicenseReturnCompleteCallback complete)
Returns the policies associated with a licenseID or a policy of a particular licenseID

Parameters:
serverURL - URL to the license server to which licenses will be returned
licenseID - Licenses matching this licenseID will be returned.
policyID - If not null, only licenses matching this policyID will be returned
commitImmediately - False denotes the license should be marked as returned regardless of response from license server

joinLicenseDomain

public void joinLicenseDomain(DRMLicenseDomain licenseDomain,
                              boolean forceRefresh,
                              DRMOperationErrorCallback error,
                              DRMOperationCompleteCallback complete)

leaveLicenseDomain

public void leaveLicenseDomain(DRMLicenseDomain licenseDomain,
                               DRMOperationErrorCallback error,
                               DRMOperationCompleteCallback complete)