From effa244941aab59c82f5d56d88dbedb7c3c36a05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Velad=20Galv=C3=A1n?= Date: Fri, 20 Dec 2024 15:53:09 +0100 Subject: [PATCH] feat(HLS): Add support for getting license server url for PlayReady (#7790) --- lib/hls/hls_parser.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/hls/hls_parser.js b/lib/hls/hls_parser.js index 01bdc75061..86e0cef183 100644 --- a/lib/hls/hls_parser.js +++ b/lib/hls/hls_parser.js @@ -11,6 +11,7 @@ goog.require('goog.Uri'); goog.require('goog.asserts'); goog.require('shaka.abr.Ewma'); goog.require('shaka.drm.DrmUtils'); +goog.require('shaka.drm.PlayReady'); goog.require('shaka.hls.Attribute'); goog.require('shaka.hls.ManifestTextParser'); goog.require('shaka.hls.Playlist'); @@ -24,6 +25,7 @@ goog.require('shaka.media.PresentationTimeline'); goog.require('shaka.media.QualityObserver'); goog.require('shaka.media.SegmentIndex'); goog.require('shaka.media.SegmentReference'); +goog.require('shaka.media.SegmentUtils'); goog.require('shaka.net.DataUriPlugin'); goog.require('shaka.net.NetworkingEngine'); goog.require('shaka.net.NetworkingEngine.PendingRequest'); @@ -39,7 +41,6 @@ goog.require('shaka.util.MimeUtils'); goog.require('shaka.util.Networking'); goog.require('shaka.util.OperationManager'); goog.require('shaka.util.Pssh'); -goog.require('shaka.media.SegmentUtils'); goog.require('shaka.util.Timer'); goog.require('shaka.util.TsParser'); goog.require('shaka.util.TXml'); @@ -4863,6 +4864,15 @@ shaka.hls.HlsParser = class { {initDataType: 'cenc', initData: pssh}, ]); + const input = shaka.util.TXml.parseXmlString([ + '', + shaka.util.Uint8ArrayUtils.toBase64(data), + '', + ].join('\n')); + if (input) { + drmInfo.licenseServerUri = shaka.drm.PlayReady.getLicenseUrl(input); + } + return drmInfo; }