Determine the size of an HLS download before downloading

Hello all,


I know that you can download HLS playlist files and that those files can change per .ts segment, but I would think this causes a few issues:


1.) We can't determine the size of the download before we start it (why bother trying to download a 2GB video file if the user only has 0.5 GB available)

2.) If the user's network speed changes drastically, then they could conceivably get better/worse video quality on a downloaded video. Wouldn't that seem odd as a user to be playing content with no internet connection after downloading it and the video quality fluctuates?


Is there a way to specify one playlist file for the system to download without variation? And if so, is there a way to determine the size of that file before downloading?


Thanks for any and all help.

Answered by Media Engineer in 218286022

1.) Determine size before download.

I'm not aware of API for this. You could put in a TSI or a radar, but I don't know if we would support it.

HLS does not store this info. The server could obviously tell you exactly, but HLS has no way to ask. The client could compute it from the bandwidth (which is declared in the master playlist) and the duration (which is in the media playlist), but that would be an estimate.

And, of course, if you are downloading multiple rendtions it gets more complicated.

2.) Video quality fluctuations while downloading.

If you are only downloading it gets the quality you want. If you are playing while downloading, it will continue (after playback is finished) until it downloads the whole asset at the requested quality.

1. The point of streaming is that the user doesn't have to download the entire file, and doesn't have to keep all of the downloaded pieces once they've been displayed.

2. It sounds like you've never used a streaming service with the quality level set to "automatic".


Do keep in mind that in order for your stream to have different quality levels, you have to generate different quality levels. There are recommendations, but you're welcome to decide that someone on a slow connection (or a connection that hits an unexpected slowdown) doesn't get to stream your content without huge pauses.

My apologies, I should have specified that this is for offline HLS playback, so we would need to download the entire video file.

Accepted Answer

1.) Determine size before download.

I'm not aware of API for this. You could put in a TSI or a radar, but I don't know if we would support it.

HLS does not store this info. The server could obviously tell you exactly, but HLS has no way to ask. The client could compute it from the bandwidth (which is declared in the master playlist) and the duration (which is in the media playlist), but that would be an estimate.

And, of course, if you are downloading multiple rendtions it gets more complicated.

2.) Video quality fluctuations while downloading.

If you are only downloading it gets the quality you want. If you are playing while downloading, it will continue (after playback is finished) until it downloads the whole asset at the requested quality.

Determine the size of an HLS download before downloading
 
 
Q