How to Play Encrypted Media With Android MediaPlayer

Last updated April 8, 2021 by Kai Kenan


Learn how to play encrypted media files using Android MediaPlayer for any Android app – no coding required.

Play Protected Android Media is an extension to Appdome TOTALDataTM Encryption, which encrypts all data stored and generated by Android and iOS apps. Play Protected Android Media enables embedded and external media players (such as Android MediaPlayer) to access and play encrypted media files in Android apps.

This Knowledge Base article describes Appdome’s Play Protected Android Media feature and explains how to add it to any mobile app without any coding.

We hope you find this knowledge base useful and enjoy using Appdome!

About Appdome Play Protected Media

Android and iOS MediaPlayer run on a separate process from the application. Same as most Android services, it runs as a System Service, under System user (UID 0). When Appdome TOTALDataTM Encryption is enabled, all stored data generated by the app is encrypted at runtime using industry-standard AES 256  encryption (including media files). However, when MediaPlayer attempts to read the encrypted media files, it will fail to decrypt the files because it won’t have the private key.

Appdome Play Protected Media enables capturing initial access to an encrypted media file by the application and replacing it with a temporary one-time file path. This ensures that the media player can securely access unencrypted data. This feature applies secure media files and content handoff to external and embedded media players. This secured handoff is completed on-demand and while the data is in transit.

An alternative and more time-consuming solution would be for the app developer to re-write the code to work with FileProvider (Android) or use other methods than AVURLAsset/ file:// URL (iOS), which will be “aware” of the application’s encryption. However, this a technically challenging approach and in most cases, the application architecture does not allow using Content Providers. In other cases, the developer might not have access to the mobile app’s source code. Additionally, working with FileProvider is constricting, as it allows access only to a fixed list of directories declared during development. If you later want to change the list, you need to change the code.

Appdome’s Play Protected Media allows you to use standard POSIX file I/O, without any extra development effort, as an extension of Appdome TOTALDataTM Encryption. When building the app on Appdome, the developers can add a wide variety of features, SDKs, and APIs to Android and iOS apps and can choose any architecture and file I/O API.

Appdome is a no-code mobile security and development platform that allows anybody to add a wide variety of features, SDKs, and APIs to Android and iOS apps in seconds, using a simple ‘click to add’ user interface – no code or coding required.

Using Appdome, there are no development or coding prerequisites. For example, there is no Appdome SDK, libraries, or plug-ins to implement. Likewise, there is no requirement to implement encryption libraries or intercept the writing of files to the sandbox. Using a simple ‘click to add’ user interface, Appdome enables anyone to easily implement mobile app security in any iOS or Android app – instantly, no code or coding required.

How to Add Play Protected Android Media to Any Mobile App on Appdome

Start by adding a mobile app to your Appdome account. If you don’t have an Appdome account, click here to create an account.

Follow these 3 easy steps to add Play Protected Android Media to Any Mobile App.

  1. Under the Security tab, enable Data at Rest Encryption
  2. Enable Play Protected Android Media (formerly called Smart Media Sharing)
  3. Click Build My App


Play Protected encrypted Android Media


The technology behind Build My App has two major elements – (1) a microservice architecture filled with 1000s of code sets needed for mobile integrations, and (2) an adaptive code generation engine that can recognize the development environment, frameworks and methods in each app and match the app to the relevant code-sets needed to add MicroVPN to the mobile app in seconds.

Congratulations! Your build is complete!

smart media sharing for secure offline data access

After you’ve finished building your app on Appdome, there are a few remaining steps to complete your project, which you can read about in our KB article on Completing Appdome Projects (Signing, Branding, Deploying apps) on Appdome.  It explains both optional steps and required steps.

That is it – Enjoy using your newly secured app!

How Do I Learn More?

Check out Appdome’s Mobile App Security Suite or request a demo at any time.

If you have any questions, please send them our way at or via the chat window on the Appdome platform.

Prerequisites for adding Play Protected Android Media to a mobile app.

Thank you!

Thanks for visiting Appdome! Our mission is to make mobile app security easy. We hope we’re living up to the mission with your project. If you don’t already have an account, you can sign up for free.

Have a question?

Ask an expert

HilaMaking your security project a success!