Azure Media Services Integration Guide

Overview

This document describes how to integrate PallyCon Multi-DRM service in content encoding and packaging workflow using Azure Media Services.

Azure Media Services (AMS) is a cloud-based platform that enables you to build solutions that achieve broadcast-quality video streaming, enhance accessibility and distribution, analyze content, and much more.

Integration Sample

PallyCon AMS packaging sample Github repository

PallyCon AMS packaging sample shows how to integrate PallyCon Multi DRM with AMS v3 using .NET 6.0 SDK. Since this sample focused on DRM integration, only the simple VOD packaging scenario of AMS is used here.

The sample supports two types of content packaging scenarios as below:

  1. DASH_PlayreadyAndWidevine
  2. HLS_FairPlay

Please refer to the AMS SDK link for more information on AMS features.

Prerequisites

To test the integration sample, you need to prepare the items below:

  • Windows 10/11 PC
  • Visual Studio 2022 (Windows 10/11)
  • .NET 6.0 SDK: Download link
  • Azure Media Services account: Refer to this guide if you want to create one.
  • KMS token used for CPIX API communication with PallyCon KMS: This is an API authentication token that is generated when you sign up PallyCon service, and can be found on the PallyCon Console site.

How to launch and test the project

  1. Clone or download this sample repository.
  2. Open the /PallyConAMSv3DotnetSample.sln file at the root folder and select the active project to launch in Visual Studio.
  3. Set values including PallyConEncToken(KMS Token) in appsettings.json. Please refer this link if needed.
  4. Set SourceUri and ContentId in the source code.
  5. Run the project.

About PallyConKMSClientWrapper

This is a C++/CLI project which wraps a C++ library(PallyConKmsClient_MD.lib) to communicate with PallyCon KMS server. The _getContentPackagingInfoFromKmsServer_ function allows you to obtain packaging information from the KMS server.

bool PallyConKmsClientWrapper::getDashAndHlsPackagingInfoFromKmsServer(String^ content_id, String^% key_id, String^% key, String^% hls_key_uri, String^% iv, String^% pssh_widevine, String^% pssh_playready)
{
 try
 {
  PallyConKmsClient kmsClient = new PallyConKmsClient(msclr::interop::marshal_as<std::string>(strKmsURL), msclr::interop::marshal_as<std::string>(strEncToken))
        
  ContentPackagingInfo packInfos = kmsClient->getContentPackagingInfoFromKmsServer(
    msclr::interop::marshal_as<std::string>(content_id), "", PackType::DASH|PackType::HLS);
  key_id = gcnew String(packInfos.keyId.c_str());
  key = gcnew String(packInfos.key.c_str());
  hls_key_uri = gcnew String(packInfos.hlsKeyUri.c_str());
  iv = gcnew String(packInfos.iv.c_str());
  pssh_widevine = gcnew String(packInfos.pssh_widevine.c_str());
  pssh_playready = gcnew String(packInfos.pssh_playready.c_str());
 }
 catch (std::exception& e)
 {
  std::cout << e.what();
 }

  return true;
}

References

Previous
Next