Using the DRMManager class

Use the DRMManager class to manage vouchers and media rights server sessions in an AIR application. The DRMManager class is available in AIR version 1.5 or higher.

Voucher management

Whenever a user plays an online DRM-protected media file, AIR obtains and caches the license voucher required to view the content. If the application saves the file locally, and the voucher allows offline playback, then the user can view the content even if a connection to the media rights server is not available. Using the DRMManager and the NetStream preloadEmbeddedMetadata() method, you can pre-cache the voucher so that the application does not have to initiate playback to obtain the license necessary to view the content. For example, your application could download the media file and then obtain the voucher while the user is still online.

To preload a voucher, use the NetStream preloadEmbeddedMetadata() method to obtain a DRMContentData object. The DRMContentData object contains the URL and domain of the media rights server that can provide the license and describes whether user authentication is required. With this information, you can call the DRMManager loadVoucher() method to obtain and cache the voucher. The workflow for preloading vouchers is described in more detail in Preloading vouchers for offline playback.

Session management

You can also use the DRMManager to authenticate the user to a media rights server and to manage persistent sessions.

Call the DRMManager authenticate() method to establish a session with the media rights server. When authentication is completed successfully, the DRMManager dispatches a DRMAuthenticationCompleteEvent object. This object contains a session token. You can save this token to establish future sessions so that the user does not have to provide their account credentials. Pass the token to the setAuthenticationToken() method to establish a new authenticated session. (Token expiration, and other attributes, are determined by the settings of the server which generates the token. The token data structure is not intended to be interpreted by AIR application code and may change in future AIR updates.)

Authentication tokens can be transfered to other computers. To protect tokens, you can store them in the AIR Encrypted Local Store. See Storing encrypted data for more information.