Android can be a complex environment for DRM playback, there are multiple aspects to consider, here it is my best attempt to provide the best tutorials on implementing DRM in an Android app. Also it’s hard to provide global answer on DRM, it depends on use cases, content requirements, device support. Here I am just suggesting one approach but there are also others. The graph below gives a description on how video DRM works in the context of online video today.
Specifically for Android devices, the default Android player is Exoplayer which needs to be configured to support DRM, where as the Bitmovin player has this functionality out of the box. I have experience with professional DRM implementations, working config in the real world at Bitmovin, so this post is based on that experience.
- A tutorial to implement Widevine DRM in an app (code for a sample Android app also linked inside the post), basically in both cases you need to load an external module for DRM when instantiating the video player inside an app. The external module will need to be configured with the MPD and DRM License server locations, so that the player knows which content to play and how to decrypt it for playback, some resources for implementing Widevine DRM in Android:
- How to setup Bitmovin Android SDK with DRM Today content: https://bitmovin.com/docs/player/tutorials/how-to-setup-bitmovin-android-sdk-with-drm-today-content
- Android SDK using ExpressPlay (Java, Widevine DRM): https://bitmovin.com/docs/player/tutorials/how-to-setup-bitmovin-android-sdk-with-expressplay-content
- You can use a DRM test proxy server to protect and decrypt content with DRM:
- Tutorial provided by Bitmovin on creating multi DRM content, here is the link: https://bitmovin.com/docs/encoding/tutorials/how-to-create-multi-drm-protected-content-with-intertrust-expressplay
- Check playback on a player to test a stream. To test with DRM protected sample DASH content (Tears of Steel) and Widevine Test Proxy you can use this player: https://bitmovin.com/demos/drm
- Tears of Steel content for the Manifest URL, use this value:
- The test Widevine Proxy service, use this value:
- You can then playback Widevine DRM protected content!
- If you encounter difficulties use Chrome Web Inspector and in the Network tab check the request from the player to the DRM License server and the key exchange.
- Since its hard to create streams from scratch, to test that your config is working properly you can use a number of different datasets available here: https://bitmovin.com/mpeg-dash-hls-examples-sample-streams/
For a deep dive on implementing DRM with sample response and encryption commands and DASH manifest: https://videodeveloper.io/drm-frameworks-for-video-in-android-and-how-to-set-it-up