Secure playback and low-level optimizations recap
Building video player apps can be quite a complex and time-consuming process. At castLabs, we’ve been building streaming players for various platforms since 2011, constantly working on their development and optimization to create high-end player experiences that consumers expect.
We’ve started a series of webinars around our PRESTOplay SDKs. Our Android player developer specialist, Joan Treveset, held the second one on secure playback and low-level optimizations. In this blog post, we’ve summarized the webinar and highlighted fundamental playback low-level optimization techniques.
How can license delivery be optimized?
The player mediates between the DRM (digital rights management) server and the CDM (content decryption module), which generates license requests and sends them over to the server. After reviewing the request, the DRM server returns a license with the key, which is then forwarded by the player directly to CDM, which decrypts the content. On average, it takes around 200 milliseconds to deliver it.
How to make the loading process faster? One possible strategy is to start with a clear lead, when the first few seconds of content are clear, unencrypted, and start playing without any license. It provides no security threat to the content and, at the same time, reduces the player’s startup time.
With a multi-key scheme, just one license request provides multiple DRM licenses, which can be easily customized to match the required security levels. License requests and costs can be reduced just by delivering all keys in one response. For instance: if we have an OTT service with different types of subscriptions, depending on the choice of video quality (SD, HD, or 4K). By grouping keys into one license response, which provides separate keys for audio and different video renditions, we can avoid restrictions on the content or video requirements and provide smoother playback and a more efficient workflow.
How can the player be optimized?
Live channel streaming with different programs might have different protection requirements. In this case, it’s necessary to use separate keys. As mentioned above, their delivery takes time and might adversely influence customer experience. To prevent that, on the player side, we can do pre-fetching 20-30 seconds before the currently playing piece of content ends to transit smoothly between programs.
Initial video track selection
There’s no certainty that the player will get a key for the video quality that was requested. The DRM server may reject the request for various reasons. For example, the server can decide that a specific device won’t get 4K resolution because it isn’t Widevine L1 certified. The strategy we use in our SDKs to ensure robust start-up without facing quality or licensing issues is to begin by default with one of the lower qualities. Thus, it significantly minimizes the risk of not getting the key for the initial quality selection, reduces overall downloading time, and allows you to switch freely to HD or 4K after receiving a multi-key license response.
Another improvement we offer, while essentially dealing with mixed content, is a placeholder session. For example, we have a program followed by another where one is unencrypted or contains ads in the middle. We can easily overcome this issue by creating a placeholder session and sending a signal to the player to use a secure decoder and create a DRM session, even if the content that will be played first is unencrypted. That way, when the key is delivered, everything is ready to provide a protected and high-quality player experience, and a seamless transition from unencrypted to encrypted content.
How can license and key changes be optimized?
- Manifest key change: Ensures smooth playback across the boundary for live streaming channels and programs with different security requirements by fetching required separate keys with corresponding licenses a bit ahead in time.
- Key rotation: Creates an additional level of protection when a high level of security is required. It removes the restriction to change keys only across media boundaries, as it can be also done inside the stream, while one single logical element is playing. The key can change, for example, every 30 seconds (the periods are configurable), which prevents and significantly reduces the chance of content leakage.
- License renewal: Saves costs by storing offline licenses for live streaming channels. The key used to encrypt the content is the same, but the license we return to the player differs and has a limited-time validity, which can range from a few seconds to months.
Our PRESTOplay video playback solution supports all of the above optimization techniques to provide the latest and greatest features for delivering amazing playback experiences customers will love. It was built by developers for developers to help your service deploy to market fast and securely stream in the highest content quality possible while minimizing cost.