hls_fragments_per_key
The `hls_fragments_per_key` directive specifies the number of HLS fragments generated for each encryption key.
Description
The hls_fragments_per_key directive is utilized within the NGINX RTMP module, particularly for applications that support HTTP Live Streaming (HLS) with encrypted media. This directive dictates the number of segments or fragments that will be created per encryption key when streaming a video. By managing the number of fragments associated with each encryption key, it enhances both the streaming performance and security of the media content.
When enabled, each encryption key will produce a finite number of HLS fragments, which are then delivered to the client. This allows for more efficient memory and resource management during live streaming, particularly beneficial in scenarios where multiple streams are simultaneously handled. The fragments must be constructed to comply with HLS specifications to ensure seamless playback across various devices.
It is important to consider the implications of setting this value too high or too low, as it can affect playback continuity and the ability to efficiently manage keys for encrypted streams. Setting an optimal number of fragments can facilitate improved caching and buffering strategies as well.
Config Example
hls_fragments_per_key 4;
Setting this value too high may lead to excessive memory usage during streaming.
Not specifying this directive may result in an unoptimized key usage and stream management.