hls_cleanup

The hls_cleanup directive controls whether HLS segments are automatically cleaned up after playback ends.

Syntaxhls_cleanup on | off;
Defaultoff
Context
Arguments1

Description

The hls_cleanup directive is a Boolean setting utilized within the NGINX RTMP module to determine if HLS segments should be automatically deleted from the server after the playback has concluded. When set to 'on', the server will clean up the unused HLS segments, freeing up space and managing resources effectively. This directive is useful in scenarios where continuous streaming takes place, ensuring that outdated segments do not accumulate and lead to excessive storage use.

In practice, when this directive is enabled (i.e., set to 'on'), whenever a user stops playback, segments that are no longer needed are deleted based on the configured cleanup mechanism. This helps to maintain optimal performance on the server by ensuring it does not handle a growing list of obsolete files and reduces the likelihood of running out of disk space. Conversely, if the directive is set to 'off', HLS segments will persist on the server even after playback has ended, which may be beneficial for debugging purposes or for keeping playback history but can lead to storage issues if not monitored.

Config Example

hls_cleanup on;

Ensure the cleanup process does not interfere with live streaming demands; setting this to 'on' may lead to unintentional loss of needed segments if not managed properly.

Verify permissions on the cleanup directory to prevent access issues when trying to delete segments.

← Back to all directives