The QUERYPARAM tag was introduced in version 13 of the HLS draft during Apple WWDC23. It is an attribute of the EXT-X-DEFINE tag in an HLS playlist.
The value of QUERYPARAM is a quoted string which specifies the Variable Name and indicates that its value is the value associated with the query parameter of the same name in the URI of the Playlist. The value associated with the query parameter must be percent-decoded before performing the variable replacement, and the decoded value must not contain any of the characters disallowed in quoted-strings.
If the QUERYPARAM attribute value does not match any query parameter in the URI or the matching parameter has no associated value, the parser must fail to parse the Playlist. If more than one parameter matches, any of the associated values may be used.
Finally, if the URI is redirected, the client must look for the query parameter in the 30x response URI.
What can we do with the QUERYPARAM HLS tag?
The QUERYPARAM tag in HLS playlists provides a way to dynamically adjust the content of a playlist based on parameters passed in the URL. This can be useful in a variety of scenarios, such as:
Personalization: The QUERYPARAM tag can be used to personalize the media content delivered to different users. For example, a server could use a query parameter in the URL to determine the user's preferences or settings, and then use this information to customize the playlist.
A/B Testing: The QUERYPARAM tag could be used to conduct A/B testing of different versions of media content. Different versions of the content could be identified by different query parameters, and the server could use the QUERYPARAM tag to determine which version to deliver to a particular user.
Ad Insertion: The QUERYPARAM tag could be used in scenarios where ads are dynamically inserted into the media stream. A query parameter in the URL could identify the ad to be inserted, and the server could use the QUERYPARAM tag to insert the appropriate ad into the playlist.
Content Variation based on User Location: The QUERYPARAM tag could be used to deliver different content or ads based on the user's geographic location. The location could be passed as a query parameter in the URL, and the server could use the QUERYPARAM tag to adjust the playlist accordingly.
In all these cases, the QUERYPARAM tag provides a powerful tool for delivering customized media streams to different users based on parameters passed in the URL, while still being compatible with most CDNs without the requirement of edge computing.
Compared to manifest manipulation with URL rewriting (as done by iReplay for example) that can provide the same benefits with a managed delivery, it requires players compatible with the very last version of HLS (Version 13)