arut / nginx-rtmp-module

NGINX-based Media Streaming Server
http://nginx-rtmp.blogspot.com
BSD 2-Clause "Simplified" License
13.35k stars 3.51k forks source link

How do I pass params for application directives? #1049

Open edemir206 opened 7 years ago

edemir206 commented 7 years ago

I would like to have 3 different hls_playlist_length sizes.

Can i do something like this when publishing ? rtmp://localhost:1935/appname?playlistlength=3600

and retrive this query string in application block applying to the hls_playlist_length directive ?

Or how can i achive such functionality without having to duplicate all my applications ?

MrFiregore commented 7 years ago

Hi, you can catch this parameters passed by the get method if you define a hook, for example this directive inside your application directive: on_play: http://expample.com:8080/index.php

Then in this index.php ( in nginx I defined the root path /var/www/html/) you can get the "3600" for example with:

if(isset$_POST["playlistlength"]) $playlistlength = $_POST['playlistlength'];

I learn this method with this tutorial : https://helping-squad.com/nginx-rtmp-secure-your-nginx-server/