Stream name passed to on_publish url parameters?
I would like to send the name of a published stream to an API. In my app I would have
on_publish http://localhost:3000/register?stream=${name}
Is there a way sorrect to get the stream name? Currently I'm using
exec curl http://localhost:3000/register?stream=${name}
the problem is that this gets called every couple seconds and I only want it called on_publish and I'd like to be able to use on_publish_done to unregister a stream.
Stream name is passed by default.
All variables are passed by selected method. Check your _POST, _GET variables for 'app' and 'name' keys. Those are application and stream name passed by module.
I cant seem to access the $name variable in /auth after i do this on_publish http://localhost:8080/auth; what do you guys mean by the stream name is passed by default?
@kwenyao The variables listed here https://github.com/arut/nginx-rtmp-module/wiki/Directives#on_play are POSTed. So if you for example want to get $name in PHP it would be $_POST['name']
Late to the party, but nevertheless. For anyone wondering how to do this easily, you can change the notify_method to get. Then the arguments will be passed on the url.
notify_method get;
on_publish http://localhost/; # not the trailing slash is needed
Will result in the following example GET
http://localhost?app=live&flashver=FMLE/3.0&swfurl=rtmp://localhost/live&tcurl=rtmp://localhost/live&pageurl=&addr=127.0.0.1&clientid=1&call=publish&name=stream&type=live