play_local_path

The 'play_local_path' directive specifies the local filesystem path for media playback in the NGINX RTMP module.

Syntaxplay_local_path path;
Defaultnone
Context
Arguments1

Description

The 'play_local_path' directive in the NGINX RTMP module allows you to define a specific path on the local filesystem where MP4 files are stored and can be served for playback. When streaming via RTMP, the server can retrieve and serve files from this specified directory, making it a crucial integration point for on-demand streaming applications.

This directive accepts a single argument, which should be a valid file path. The path can point to a directory where the media files (e.g., MP4 files) are located. If a request is made to play a stream, the NGINX server will look in this directory for the corresponding file to serve to clients. Utilizing this feature allows for greater control over video resources and can enable structured playback setups, such as serving pre-recorded content.

In terms of behavior, if the specified path does not exist or if there are permission issues, the requests for playback will fail. Therefore, it is important to ensure both that the path exists and that the NGINX user has the appropriate read permissions. This requirement adds a layer of administrative responsibility when managing media file paths in an RTMP-powered environment.

Config Example

application playlocal {
    play_local_path /var/www/media;
    live on;
}

Ensure that the specified path exists; otherwise, playback will fail.

The NGINX user must have read permissions for the specified path to serve the files appropriately.

Avoid using paths with spaces or special characters, as these may lead to misinterpretation by the server.

← Back to all directives