-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Difference between on_play and on_publish #1730
Comments
With on_publish you can forward the on publish request to a server. I use it to allow users to use the same streamkey but redirect to another application with the name set to the actual uuid of the individual stream I want to begin. That is my workflow. on_play I havent used. Maybe someone else has a better explanation. See my example go server:
Took me a while to figure this out. Its primarily for a use case in which I can handle authentication and setting of stream id/pathing without having user change their streamkey ever. Redirect it back to your nginx but to another application that actually ingests stream. Otherwise, I dont think you need to use on_publish if you dont have any sort of ceremony your streaming solution needs to do. My understanding of on_publish_done is that fires when the stream has ended. So when the stream is complete and you have business logic for complete streams you should use that. |
@lovgrandma Sorry for reverting late. Got lost in the list of notifications on Git. I did exactly Already what you have done for on_publish and on_publish done. I still cant wrap my head around on_play and on_play done. Form the directives listed here https://github.com/arut/nginx-rtmp-module/wiki/Directives#on_publish |
I know this is old issue, but "on_play" is called when someone is trying to view/read/access the stream. "on_publish" is for when someone is trying to publish a stream. on_publish: can be used to authenticate a stream key and redirect the key to a new location for direct playback without leaking the private stream key on_publish_done: can be used to de-auth a stream key, you could set a stream in a database as "live" from "on_publish" and then with "on_publish_done" set it as "offline" on_play: can be used to deny if a stream is private and a wrong password is given, and to increment a view counter on_play_done: is when a reader/viewer has finished playback. It could be used to remove a "viewer" from a live view counter. Edit: |
I can't understand the difference between on_play and on_publish. Can @arut please explain to me in simple terms ?Your response would be helpful. I can't understand which one to use.
My use case is : Have a django api server for authentication and I intend to use the nginx rtmp module for live streaming and video on demand. For live, i'm currently using the on_publish and on_publish_done which point to 2 functions on my django end to invoke a start a stream and stop a stream. However, For VOD, however, I need to allow the user to upload the file first to nginx after clicking upload and then nginx handles the processing and playing. Can I use the same 2 on_publish and on_publish_done to accept an upload from django end inside the rtmp block.
I have something like this :
The text was updated successfully, but these errors were encountered: