-
-
Notifications
You must be signed in to change notification settings - Fork 576
Directives
This table is only for the new added directives in this module, for details of other directives, please refer to nginx-rtmp-module directives.
Syntax: flv_live on|off
Default: flv_live off
Context: location
Enable playing a live flv stream in this location.
location /live {
flv_live on;
}
Syntax: chunked_transfer_encoding on|off
Default: chunked_transfer_encoding off
Context: location
Add a Transfer-Encoding: chunked
HTTP header when sending response to the player and enable HTTP chunked transmission, otherwise Expires: -1
HTTP header is sent. Note that not all players support HTTP chunked transmission.
Since the latest codes have become more and more compatible with HTTP modules Nginx supplies, the standard directive chunked_transfer_encoding
Nginx supports replaces the feature chunked
provides.
location /live {
flv_live on;
chunked_transfer_encoding on;
}
Syntax: gop_cache on|off
Default: gop_cache off
Context: application
Cache GOP(s) (Group Of Pictures) when a stream is being published, once a play is coming, send the cached GOP(s) at first. This decreases the time waiting for the first picture of a video to be displayed.
Note that gop_cache will not function when a pull stream is played, since publish on the remote host is triggered after play is initialed, there is no GOP yet at that time.
application myapp {
...
gop_cache on;
}
Syntax: server_name *.domain.suffix|prefix.domain.*|prefix.domain.suffix|regexp
Default: --
Context: server
The functionality of server_name
directive is as same as in the http
block.
server_name prefix.domain.suffix;
Syntax: add_header name value [always];
Default: --
Context: http, server, location, if in location
Adds the specified field to a response header provided that the response code equals 200, 201 (1.3.10), 204, 206, 301, 302, 303, 304, 307 (1.1.16, 1.0.13), or 308 (1.13.0). The value can contain variables.
There could be several add_header directives. These directives are inherited from the previous level if and only if there are no add_header directives defined on the current level.
If the always parameter is specified (1.7.5), the header field will be added regardless of the response code.
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Credentials' 'true';
Syntax: on_connect url;
Default: --
Context: rtmp, server
Compatible with on_connect
directive in nginx-rtmp-module, please refer to on_connect in nginx-rtmp-module.
on_connect http://example.com/on_connect.php;
Syntax: on_play url;
Default: --
Context: rtmp, server, application
Compatible with on_play
directive in nginx-rtmp-module, please refer to on_play in nginx-rtmp-module.
on_play http://example.com/on_play.php;
Syntax: notify_no_resolve on|off
Default: notify_no_resolve on
Context: rtmp, server, application
Used to control the action taken by Nginx for notifications. The interface getaddrinfo
used to resolve the domain names is blocking, it may cost so much time to get the IPs from the DNS servers and that is UNACCEPTABLE for Nginx addressing thousands connections, so unless you can resolve the domain names very quickly, it is better to set it as on
and use IPs instead of domain names in on_connect
, on_play
and so on.
notify_no_resolve off;