I wanted to create a new live streaming url for the same event after stopping it and starting it again via code.
So for this, once the event is stopped and started again I am creating a new asset as well as locator such that new streaming urls can be generated via code. But the newly generated urls is not working in azure media player.
I also wanted to persist old urls such that user can view it after live event is stopped via urls as it is recorded in assets.
So I was not deleting the existing live output, assets and locators via client.LiveOutputs.DeleteAsync, etc calls
Code to create new asset with new name
Asset asset = await _client.Assets.GetAsync(_config.ResourceGroup, _config.MediaServiceAccountName, assetName);
if (asset == null)
{
asset = await _client.Assets.CreateOrUpdateAsync(_config.ResourceGroup, _config.MediaServiceAccountName, assetName, new Asset());
}
Code to create new locator with new name
locator = await _client.StreamingLocators.CreateAsync(_config.ResourceGroup,
_config.MediaServiceAccountName,
drvStreamingLocatorName,
new StreamingLocator
{
AssetName = assetName,
StreamingPolicyName = PredefinedStreamingPolicy.ClearStreamingOnly,
Filters = filters // Associate the dvr filter with StreamingLocator.
});
fetch live streaming urls
List<string> manifests = BuildManifestPaths(scheme, hostname, locator.StreamingLocatorId.ToString(), manifestName);