Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change stream name after on_publish call #713

Open
zerogee00 opened this issue Oct 31, 2015 · 8 comments
Open

Change stream name after on_publish call #713

zerogee00 opened this issue Oct 31, 2015 · 8 comments

Comments

@zerogee00
Copy link

I have a system setup where publishers get a streamkey (lets say abc123) from my api and are able to stream to an app named 'stream' where it creates HLS playlist and TS files. (abc123.m3u8, etc) They point their encoders to rtmp://streaming.server.com/stream/abc123

Then via on_publish it calls an 'authentication application' that checks if that streamkey is in our api and then returns 200 if it is and 4xx if it isn't. It can also look up a more public key (xyz789) at this point (but how would I return that key to the rtmp module?)

What I then need to be able to do it somehow change the stream name to that public key and have the files named xyz789.m3u8 etc so that only the publisher and not any clients know the original streamkey and can watch the stream via http://streaming.server.com/stream*/xyz789.m3u8

*or another redirected app

@zerogee00
Copy link
Author

Any ideas?

@cccaochao
Copy link

you could rewrite rtmp URL or stream name by set on_publish .

@misiek08
Copy link
Contributor

misiek08 commented Nov 5, 2015

on_publish notify event allows you to change stream name by setting Location header to desired value in response.

@zerogee00
Copy link
Author

Do I need to return a 300 for it to redirect properly? Also do I need to have separate app or can it be the same app with just new stream name?

@cccaochao
Copy link

@zerogee00 you are right.

@misiek08
Copy link
Contributor

misiek08 commented Nov 5, 2015

Any 3xx code should work. You don't need separate app. You can handle it in your script and if you return 200 code without Location header nginx won't change name, so you can change name only for some publishers.

@zerogee00
Copy link
Author

Thanks everybody - this worked great I am changing the name by setting location in the header and returning 300.

@headbutt
Copy link

I have the same problem, but it doesn't change the directory name it remains the same.

winshining added a commit to winshining/nginx-rtmp-module that referenced this issue Apr 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants