Reputation: 462
I'm currently developing an Angular application in which you can watch some videos. The videos get streamed over HLS from an Azure Media Service. So they are encoded for adaptive streaming. For the player I'm using Plyr.
Now I want to be able to watch these videos when I'm offline. So first I'm turning my application into an PWA.
But then, how can I download videos from an Azure Media Service and play them within Plyr?
Upvotes: 1
Views: 544
Reputation: 2512
You can get a SAS URL to the container that hosts the Assets video files. If you encoded in Azure Media Services, you will find a collection of MP4 files with different bitrates and resolutions in that folder. You can just use the storage API to get a SAS URL and just download it.
See the samples here for .NET which shows how to encode and download in .NET https://github.com/Azure-Samples/media-services-v3-dotnet/blob/main/VideoEncoding/Encoding_H264/Program.cs
You can look at the lines in DownloadResults to see how to get a SAS token URL - https://github.com/Azure-Samples/media-services-v3-dotnet/blob/a611f5559d7c907a8618e0525df57e1577532f17/VideoEncoding/Encoding_H264/Program.cs#L573
Upvotes: 1
Reputation: 19484
I havent working with media services but I assume this will help
You would need to have backend which will create you temporary link to download, then you can download and save on client side
Upvotes: 1