Esempio n. 1
0
        private void ParseYoutubeScheme(ContentProtection descriptor)
        {
            var doc = new XmlDocument();

            try
            {
                doc.LoadXml(descriptor.Data);
            }
            catch (Exception)
            {
                return;
            }

            if (doc.FirstChild?.ChildNodes == null)
            {
                return;
            }

            foreach (XmlNode node in doc.FirstChild?.ChildNodes)
            {
                var type = node.Attributes?.GetNamedItem("type")?.Value;
                if (!EmeUtils.SupportsType(type))
                {
                    continue;
                }

                var drmDescriptor = new DrmDescription
                {
                    LicenceUrl = node.InnerText,
                    Scheme     = type
                };
                setDrmConfigurationSubject.OnNext(drmDescriptor);
            }
        }
Esempio n. 2
0
        public async Task UpdateDrmConfiguration(DrmDescription drmDescription)
        {
            Logger.Info("Updating DRM configuration.");

            using (await clipDrmConfigurationsLock.LockAsync())
            {
                var currentDescription = clipDrmConfigurations.FirstOrDefault(o => string.Equals(o.Scheme, drmDescription.Scheme, StringComparison.CurrentCultureIgnoreCase));
                if (currentDescription == null)
                {
                    clipDrmConfigurations.Add(drmDescription);
                    return;
                }

                if (currentDescription.IsImmutable)
                {
                    Logger.Warn($"{currentDescription.Scheme} is immutable - ignoring update request");
                    return;
                }

                if (drmDescription.KeyRequestProperties != null)
                {
                    currentDescription.KeyRequestProperties = drmDescription.KeyRequestProperties;
                }
                if (drmDescription.LicenceUrl != null)
                {
                    currentDescription.LicenceUrl = drmDescription.LicenceUrl;
                }
            }
        }
Esempio n. 3
0
 public async Task OnSetDrmConfiguration(DrmDescription description)
 {
     if (drmManager == null)
     {
         return;
     }
     await drmManager.UpdateDrmConfiguration(description);
 }
Esempio n. 4
0
        private static DrmDescription CreateWidevineDrmDescription()
        {
            var licenceUrl    = "https://proxy.uat.widevine.com/proxy?provider=widevine_test";
            var configuration = new DrmDescription()
            {
                Scheme               = EmeUtils.GetScheme(WidevineSystemId),
                LicenceUrl           = licenceUrl,
                KeyRequestProperties = new Dictionary <string, string>()
                {
                    { "Content-Type", "text/xml; charset=utf-8" }
                },
            };

            return(configuration);
        }
Esempio n. 5
0
        private static DrmDescription CreatePlayReadyDrmDescription()
        {
            var licenceUrl =
                "https://dash-mse-test.appspot.com/api/drm/playready?drm_system=playready&source=YOUTUBE&ip=0.0.0.0&ipbits=0&expire=19000000000&sparams=ip,ipbits,expire,drm_system,source,video_id&video_id=03681262dc412c06&signature=448279561E2755699618BE0A2402189D4A30B03B.0CD6A27286BD2DAF00577FFA21928665DCD320C2&key=test_key1";
            var configuration = new DrmDescription()
            {
                Scheme               = EmeUtils.GetScheme(PlayreadySystemId),
                LicenceUrl           = licenceUrl,
                KeyRequestProperties = new Dictionary <string, string>()
                {
                    { "Content-Type", "text/xml; charset=utf-8" }
                },
            };

            return(configuration);
        }