Playing DRM-protected audio content

You can use the DRM Audio Player API to play DRM-protected audio content on a mobile device. If you need to read or edit the audio content, use the Symbian OS Content Access Framework (CAF) API. For more information, see Using content access framework.

The following APIs are related to DRM:

  • DRM Audio Player API

    Allows applications to play DRM-protected files without DRM capability.

  • Content Access Framework (CAF) API

    Allows applications to play DRM-protected files. Certain methods require DRM capability.

  • DRM Helper API

    Allows you to deal with DRM-specific error situations. This API can be used with DRM Audio Player API or CAF API.

  • OMA DRM CAF Agent API

    Allows applications to access OMA DRM-specific content and rights. This API requires CAF API.

  • DRM License Checker API

    Allows you to use DRM to protect data files in applications. This API is not related to the APIs above and is not necessary for playing multimedia content.

The following figure illustrates the relationship between the APIs.

Figure: The relationship between different DRM-related APIs

For information on downloading DRM-protected content, see Browsing & downloading.

For information on playing DRM-free content, see Playing audio files on Forum Nokia.

Important implementation considerations include:

  • OMA DRM and WMDRM are not interoperable. Mobile device users are not able to use content created in one DRM system in the other one.

  • Pay attention to the size of the final binary file. Mobile device users may be charged by the size of the file when downloading it. The amount of available memory on the device may also impose limitations on the file size. For details on the available memory on a particular device, see Devices on Forum Nokia. Choose a device model and see the memory details.

  • Multimedia applications can consume the battery power rapidly. For more information, see Power management on Forum Nokia.

To play DRM-protected audio on a device

  1. Use the methods of the CDrmPlayerUtility class of DRM Audio Player API to construct your application. CDrmPlayerUtility provides the same interface as CMdaAudioPlayerUtility. With the exception of the class name, most of the code is the same.

    The DRM Audio Player API allows applications without DRM capability to play DRM-protected content. The DRM capability grants access to alter DRM-protected content. Playback of the content does not require the capability.

    The CDrmPlayerUtility is defined in the drmaudiosampleplayer.h header file. Add the following line to the cpp file, which is used to deploy the API:

    #include <drmaudiosampleplayer.h>

    The following code snippet shows a class that contains one public method, Play(), to play a DRM-protected audio file:

    class CDrmAudioExample: public CBase, MDrmAudioPlayerCallback
        {
    public: // Constructor and destructor
     
        CDrmAudioExample();	
        ~CDrmAudioExample();
    	
    public: // Public methods
     
        void PlayL(const TDesC& aFileName);
     
    private: // From MdrmAudioPlayerCallback
    	
        void  MdapcInitComplete(TInt aError,
            const TTimeIntervalMicroSeconds &aDuration);
        void  MdapcPlayComplete (TInt aError);
    	
    private: // Member variables
     
        CDrmPlayerUtility* iPlayerUtility;
        RFile iFile;
    	
        };

    The following code snippet shows the implementation of the above header file:

    CDrmAudioExample::CDrmAudioExample()
        {
        }
     
    CDrmAudioExample::~CDrmAudioExample()
        {
        if (iPlayerUtility)
            {
            iPlayerUtility->Stop();
            delete iPlayerUtility;
            }
        iFile.Close();
        }
    	
    void CDrmAudioExample::PlayL(const TDesC& aFileName)
        {
        // Delete old instance of iPlayerUtility and close the file.
        if (iPlayerUtility)
            {
            iPlayerUtility->Stop();
            delete iPlayerUtility;
            iPlayerUtility = 0;
            }
        iFile.Close();
    	
        // Create a new instance of iPlayerUtility and open the file.
        iPlayerUtility = CDrmPlayerUtility::NewL(
            *this, EMdaPriorityNormal, EMdaPriorityPreferenceNone);
        iFile.Open(CCoeEnv::Static()->FsSession(), aFileName,
            EFileShareReadersOnly | EFileStream | EFileRead);
        iPlayerUtility->OpenFileL(iFile);	
        }
     
    void  CDrmAudioExample::MdapcInitComplete(TInt aError,
            const TTimeIntervalMicroSeconds &aDuration)
        {
        if (KErrNone == aError)
            {
            // Set the volume to half of the maximum volume.
            iPlayerUtility->SetVolume( iPlayerUtility->MaxVolume() / 2 );
            iPlayerUtility->Play();
            }
        }
     
    void CDrmAudioExample::MdapcPlayComplete(TInt aError)
        {
        }

    The DRM Helper API can be used for dealing with DRM-specific error situations, such as getting rights details, registering and unregistering DRM-protected content for automated use, and getting details of DRM-protected content. The DRM Helper API is a library API and can be used alongside the DRM Audio Player API or the CAF API.

  2. Make sure that drmaudioplayutility.lib is accessible to your linker when compiling your application by including it in your mmp file or by editing the project properties in your IDE, depending on your build environment.

  3. Make sure that you have the correct capabilities information set for your application. Depending on your application, you may need DRM or MultimediaDD, for example. The DRM Audio Player API does not require any capabilities to play DRM-protected content.