application
The 'application' directive in the NGINX RTMP module defines a streaming application context for handling media streams.
Description
The 'application' directive is crucial for distinguishing different streaming applications within the RTMP server configuration. Each application configured using this directive functions as a separate namespace, allowing for specialized settings and handling of media streams. Within an ‘application’ block, parameters can be specified that control how streams are published, played, recorded, and handled overall. Several features offered by this directive relate closely to live streaming behavior, authentication, access control, and recording setups, essentially defining how the RTMP server communicates with clients regarding specific media streams.
Moreover, the 'application' directive opens up various nested configuration options, such as defining the 'live' setting for live streaming or enabling recording settings through attributes like 'record', 'record_path', and various access control settings like 'allow' and 'deny'. This flexibility allows the operator to tailor the behavior of each application to their specific use cases while leveraging common operational features of the RTMP protocol. Each instance of the 'application' directive can uniquely cater to different streaming needs without conflicting with other applications defined under the same RTMP server block.
When defining the 'application' directive, it takes the form of a block that can encompass multiple settings. The directives within this block may include settings for fragment length, playlist length, and the handling paths for DASH if streaming in that format. Because of its nature as a block directive, a well-structured configuration is essential to ensure that all needed parameters are defined clearly, avoiding ambiguity in stream handling.
Config Example
rtmp {
server {
listen 1935;
application live {
live on;
record all;
record_path /var/www/html/recordings;
allow publish all;
deny play all;
}
}
}Ensure the application block is closed properly; missing a closing brace can lead to configuration errors.
Misconfigurations within this directive can result in streams not being accessible or allowed due to access control rules.
If specific settings like 'allow' and 'deny' are not configured properly, unintended access restrictions may occur.