private static void PublishAsset(MediaClient mediaClient, IAsset asset, ContentProtection contentProtection) { if (asset.IsStreamable) { string locatorId = null; LocatorType locatorType = LocatorType.OnDemandOrigin; List <ILocator> locators = asset.Locators.Where(l => l.Type == locatorType).ToList(); foreach (ILocator locator in locators) { if (locatorId == null) { locatorId = locator.Id; } locator.Delete(); } List <IAssetDeliveryPolicy> deliveryPolicies = asset.DeliveryPolicies.ToList(); foreach (IAssetDeliveryPolicy deliveryPolicy in deliveryPolicies) { asset.DeliveryPolicies.Remove(deliveryPolicy); } if (contentProtection != null) { mediaClient.AddDeliveryPolicies(asset, contentProtection); } mediaClient.CreateLocator(locatorId, locatorType, asset, false); } }
internal static void PublishStream(MediaClient mediaClient, IAsset asset, ContentProtection contentProtection) { if (asset.IsStreamable || asset.AssetType == AssetType.MP4) { if (asset.Options == AssetCreationOptions.StorageEncrypted && asset.DeliveryPolicies.Count == 0) { mediaClient.AddDeliveryPolicies(asset, contentProtection); } if (asset.Locators.Count == 0) { LocatorType locatorType = LocatorType.OnDemandOrigin; mediaClient.CreateLocator(null, locatorType, asset, null); } } }