exec_play_done
Executes specified external commands/scripts when a playback is completed in the RTMP application.
Description
The exec_play_done directive in the NGINX RTMP module allows you to define external commands or scripts that will be executed once playback is finished for a stream. This is particularly useful for integrating other processes, such as logging, notifications, data processing, or any custom workflow that needs to be triggered after a media playback session ends.
The directive takes one or more arguments, which are expected to be the paths to the executables or scripts that you want to run. These commands will be executed in the context of the NGINX worker process that is handling the stream, enabling seamless integration into your existing server functionality. It's important to consider the permissions and accessibility of these scripts, as the NGINX worker must have the necessary rights to execute them. Additionally, you should ensure that the external command does not block the NGINX worker process for too long to maintain optimal server performance.
Keep in mind that because the commands are executed in the server's context, proper error handling within the scripts and validation of parameters may be necessary to avoid impacting the NGINX performance or causing unwanted behavior.
Config Example
application live {
live on;
exec_play_done /usr/local/bin/cleanup_script.sh;
}Ensure that the external commands are executable by the NGINX user.
Beware of long-running commands that may block NGINX worker processes.
Always validate inputs to avoid command injection vulnerabilities.