Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using variables in vod_hls_segment_file_name_prefix and vod_dash_fragment_file_name_prefix #1539

Open
nonth opened this issue Aug 30, 2024 · 3 comments

Comments

@nonth
Copy link
Contributor

nonth commented Aug 30, 2024

Is it possible to use variables, such as $vod_clip_id in the vod_hls_segment_file_name_prefix and vod_dash_fragment_file_name_prefix directives.

Our use case is as follows:

  1. A video player requests a video from a URL formatted as {vod_set_id}/master.m3u8 or {vod_set_id}/manifest.mpd
  2. The nginx-vod-module then queries our API to retrieve a mapping response based on the vod_set_id
  3. The API returns a mapping response containing the vod_set_id along with sequences where each sequence has its own vod_sequence_id and corresponding video/audio MP4 file.
  4. The nginx-vod-module uses the response from the API to create the m3u8/mpd file and returns it to the video player.
  5. In our backend, users can change the video or audio MP4 file, which updates the vod_sequence_id in the API response.

We have deployed the nginx-vod-module behind a CDN, which caches the TS/M4S segments. When the scenario described above occurs, we would like to update the segments by altering the segment names using a variable, such as vod_sequence_id

@nonth nonth changed the title Using Variables in vod_hls_segment_file_name_prefix and vod_dash_fragment_file_name_prefix Using variables in vod_hls_segment_file_name_prefix and vod_dash_fragment_file_name_prefix Aug 30, 2024
@erankor
Copy link
Contributor

erankor commented Sep 2, 2024

This is not supported.
The common solution to the caching issue you described is to change the path of the URL instead. For example, you can use a URL like - http://domain/video/{id}/version/{ver}/master.m3u8. If you change the version, the manifest and all segments get a new URL, and bypass the CDN cache.

@nonth
Copy link
Contributor Author

nonth commented Sep 2, 2024

Hi @erankor

Thanks for your answer.
Unfortunately, the user can’t change the URL of the master playlist (m3u8/mpd) since it’s already being used on their website/app. Is there any way to change the URLs for the sub-playlists (m3u8) or the segment files (TS/M4S) instead?

Thanks again for your help!

@erankor
Copy link
Contributor

erankor commented Sep 13, 2024

You can solve it with HTTP redirection - have the master URL used by the website/app redirect to the nginx-vod-module master URL (cached on the CDN). Then, when you want to publish a new version, you just change the redirection to point a new URL, that has a new version, and therefore bypasses the CDN cache.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants