Video Digital Rights Management for Roku Apps

The Roku platform supports various types of DRM; see the Roku documentation for more details. With You.i Engine One, you can specify the DRM scheme and attributes for your video stream.

Note that if using Widevine, you’ll also need to update your manifest file.

You.i Engine One supports Roku DRM schemes in two ways via C++ applications. For Widevine and PlayReady DRM, the preferred way of providing the DRM attributes is to use CYIAbstractVideoPlayer::DRMConfiguration.

DRMConfiguration

Widevine has only one required attribute, licenseServerURL. The following example shows how to configure that attribute for Widevine DRM. If you need to set any of the optional attributes, use the Generic DRM method described below instead.

std::unique_ptr<CYIWidevineModularDRMConfiguration> pDRMConfiguration(new CYIWidevineModularDRMConfiguration());
pDRMConfiguration->SetLicenseAcquisitionUrl(licenseServerUrl);
pPlayer->Prepare(videoUrl, CYIAbstractVideoPlayer::StreamingFormat::DASH, CYIAbstractVideoPlayer::PlaybackState::Paused, std::move(pDRMConfiguration));
pPlayer->Play()

PlayReady has the required attributes: encodingKey and encodingType. Unless you’re using a custom license acquisition request, encodingType is always “PlayReadyLicenseAcquisitionUrl”. You.i Engine One handles setting that for you. To specify your encodingKey, use SetLicenseAcquisitionUrl() as in the following example for PlayReady DRM:

std::unique_ptr<CYIPlayReadyDRMConfiguration> pDRMConfiguration(new c());
pDRMConfiguration->SetLicenseAcquisitionUrl(licenseServerUrl);
pPlayer->Prepare(videoUrl, CYIAbstractVideoPlayer::StreamingFormat::DASH, CYIAbstractVideoPlayer::PlaybackState::Paused, std::move(pDRMConfiguration));
pPlayer->Play()

If your PlayReady implementation requires custom license acquisition, set your custom data with the following command, before calling Prepare() on your player. You.i Engine One will automatically change the encodingType to “PlayReadyLicenseAcquisitionAndChallenge” and correctly format encodingKey with your URL and custom data.

  • CYIPlayReadyDRMConfiguration::SetLicenseAcquisitionCustomData(const CYIString)

If you need to set any of the optional attributes for PlayReady, use the Generic DRM method described below instead.

Generic DRM

For other DRM schemes, or alternately for PlayReady and Widevine, you can use a generic method to specify the required metadata. Craft a JSON object and pass it in to the player as in the following example.

yi::rapidjson::Document drmParam;
drmParam.SetObject();
CYIRapidJSONUtility::AddStringField(&drmParam, "name", "AdobeAccess");
CYIRapidJSONUtility::AddStringField(&drmParam, "appData", "drm-token-as-a-string");
CYIRapidJSONUtility::AddStringField(&drmParam, "test", "Random_drm_property");
 
CYIAbstractVideoPlayer::VideoMetadata metadata;
metadata.insert({"drmParam", CYIRapidJSONUtility::CreateStringFromDocument(drmParam)});
CYICloud::GetInterface().SetVideoMetadata(m_pPlayer.get(), metadata);

For more information on how to debug the drmParam and videoHeaders properties , see DEBUG_PRINT_VIDEO_DRM.

Note: Only Roku’s specified list of drmParam attributes are supported.