GCP Live Stream API Integration Guide


This document describes how to integrate PallyCon Multi-DRM service in content packaging workflow using Google Cloud Platform’s Live Stream API. The Live Stream API transcodes mezzanine live signals into direct-to-consumer streaming formats, including Dynamic Adaptive Streaming over HTTP (DASH/MPEG-DASH), and HTTP Live Streaming (HLS), for multiple device platforms.

Integration Sample

PallyCon GCP Live Stream integration sample Github repository

PallyCon GCP Live Stream integration sample shows how to integrate PallyCon Multi DRM with Google Cloud Live Stream API v1 using API Client Libraries. Since this guide focused on DRM integration, only a simple scenario of applying Widevine, PlayReady, and FairPlay DRM to a live stream in fmp4 format is used, see the references link for more information about Live Stream API v1 features.


How to launch the project and test

  1. Clone or download this sample repository.
  2. Open PallyConGoogleLiveStreamSample.sln file and select the active project to launch in Visual Studio.
  3. Make sure you have your Google Cloud project, bucket information and PallyCon KMS related information.
  4. Set the values of the variables at the top of the main method.
  5. Run the project.
  6. Copy the <RTMP input endpoint uri> that is printed to the console.
  7. When the streamingState is AwaitingInput and you see the output saying the channel is ready, send a live stream to the input endpoint as shown below.
    $ ffmpeg -re -f lavfi -i "testsrc=size=1280x720 [out0]; sine=frequency=500 [out1]" \
      -acodec aac -vcodec h264 -f flv <RTMP input endpoint uri>
  8. Check out your packaging results on the Buckets page in Google Cloud console.


C++/CLI project for wrap a C++ library(PallyConKmsClient_MD.lib) to communicate with PallyCon KMS server. The getPackagingInfoFromKmsServer function allows you to obtain packaging information from the KMS server.

bool PallyConKmsClientWrapper::getPackagingInfoFromKmsServer(String^ content_id, String^% key_id, String^% key, String^% iv, String^% hls_key_uri, String^% widevine_pssh, String^% playready_pssh)
		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());
		iv = gcnew String(packInfos.iv.c_str());
		hls_key_uri = gcnew String(packInfos.hlsKeyUri.c_str());
		widevine_pssh = gcnew String(packInfos.pssh_widevine.c_str());
		playready_pssh = gcnew String(packInfos.pssh_playready.c_str());
	catch (std::exception& e)
		std::cout << e.what();

	return true;