Playing DRM-protected audio file using CDrmPlayerUtility
Most of the S60 devices support OMA DRM v1.0. However, some of them support OMA DRM v1.0 Forward-lock only. Only some devices support all of OMA DRM v1.0 protection methods, i.e. forward-lock, combined delivery and separate delivery. Some newer devices support OMA DRM v2.0, for example Nokia N73.
As the writing of this article, only a few number of S60 devices support WM-DRM. However, the code example below cannot play WM-DRM. The reason is because those devices have not integrated WM-DRM into the S60 DRM API. This situation may change in the future when WM-DRM has been supported by S60 DRM API.
To find out more information about DRM as well as how to create OMA DRM v1.0 content, take a look at some links at the end of this article.
The API to play DRM-protected audio file is very similar to the API to play unprotected file. There are some differences in the class name only.
The CDrmPlayerUtility is declared in drmaudiosampleplayer.h. Add the following line to the .cpp file that will be used to use the API.
The API is defined in the DrmAudioPlayUtility.lib. Add the following line to the .mmp file.
Note: This API does not need DRM capability in S60 3rd Edition. All DRM APIs do not need DRM capability as long as third party developers are not able to "see" the plain-text version of the data.
The following code shows a class that contains one public methods, Play(), to play DRM-protected audio file.
class CDrmAudioExample: public CBase, MDrmAudioPlayerCallback
public: // Constructor and destructor
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
The following code shows the implementation of the above header file.
void CDrmAudioExample::PlayL(const TDesC& aFileName)
// Delete old instance of iPlayerUtility and close the file.
iPlayerUtility = 0;
// Create a new instance of iPlayerUtility and open the file.
iPlayerUtility = CDrmPlayerUtility::NewL(
*this, EMdaPriorityNormal, EMdaPriorityPreferenceNone);
EFileShareReadersOnly | EFileStream | EFileRead);
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 );
void CDrmAudioExample::MdapcPlayComplete(TInt aError)
Note: The example above works on S60 3rd and 3rd MR SDK emulator. When it is run on S60 3rd FP1 SDK, the program will panic at CDrmPlayerUtility::NewL() with KERN-EXEC 0 message. Unfortunately, there is not so much information whether it is a bug in FP1 or something else.