nginx-rtmp-module icon indicating copy to clipboard operation
nginx-rtmp-module copied to clipboard

Stream name passed to on_publish url parameters?

Open notcoffeetable opened this issue 11 years ago • 5 comments

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.

notcoffeetable avatar May 14 '14 18:05 notcoffeetable

Stream name is passed by default.

arut avatar May 14 '14 19:05 arut

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.

misiek08 avatar May 15 '14 19:05 misiek08

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 avatar Jul 15 '15 10:07 kwenyao

@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']

VackerSimon avatar Jul 15 '15 13:07 VackerSimon

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

kjwierenga avatar Apr 16 '24 13:04 kjwierenga