on_done
The 'on_done' directive in the NGINX RTMP module is used to specify a callback function to be executed when a live stream has finished publishing.
Description
The 'on_done' directive allows you to define a callback that gets triggered upon the completion of a stream in live broadcasting applications. This is particularly useful for performing custom operations such as notifying an external service, logging records, or cleaning up resources after the stream ends. The associated code path is integrated into the stream lifecycle, ensuring that the specified callback is executed only after the RTMP session has cleanly concluded its publishing process.
When using this directive, you must specify a valid argument that typically represents a URL or an execution command. The directive hooks this functionality into the RTMP module’s handling of stream termination, allowing extensibility in terms of user-defined behavior post-stream. It is vital to manage any dependencies carefully, especially when interfacing with external systems based on the streaming lifecycle events.
Config Example
rtmp {
server {
application live {
live on;
on_done "http://example.com/stream_done";
}
}
}Ensure your command or URL for the callback is reachable and correctly formatted, as any errors in it may lead to silent failures.
This directive is context-sensitive; using it in the wrong context may lead to NGINX configuration errors.
Remember that the command specified should handle being invoked without a straightforward interactive session.