OvenMediaEngine
OvenMediaEngine copied to clipboard
Admission Webhooks Beta released
The AdmissionWebhooks feature has been released in the latest dev branch.
AdmissionWebhooks is an HTTP callback that queries the control server to control publishing and playback admission requests. Users can use the AdmissionWebhook for a variety of purposes, including customer authentication, tracking published streams, hide app/stream names, logging and more.
See the URL below for more information : https://airensoft.gitbook.io/ovenmediaengine/v/master/access-control/admission-webhooks
Please do a lot of testing, and don't hesitate to comment here if you find any issues.
Hey @getroot, first of all, thanks for this great feature. It's going to be a great help.
I was testing this but I am not able to get the lifetime
working... The allowed
response works as expected.
Here are the logs. I was using the default Server.xml with the Admission tag added as explained in the docs.
The RTMP stream was sent to OME from OBS with lifetime
set to 10000 milliseconds, but the stream continued after 10s. And for subscribing I observed the same behavior.
@Thunder80 Thanks for reporting. I fixed the problem and committed it to the latest master branch. Could you please test it again?
Thanks, @getroot the basic functionality works on both publisher and subscriber side tested with OBS and the hosted OvenMedia player. Will let you know if I can find any more bugs...
Hey, @getroot I was thinking if we had an option that will prevent the reconnection to the stream after the lifetime
is passed that will be a lot useful.
Example:-
As of now if we stream with OBS to OME and suppose the Admission webbook return {allowed: true, lifetime: 20000}
then after the 20s, OBS (by default) tries to reconnect after 10s and is successfully reconnected to OME then after 20s it's again disconnected.
It will really be very useful to have a fully disconnect option. So after the first disconnect from OBS(or any other streaming source) the user has to send another request to OME and OME sends another request to the Admission Server to check if the streaming or subscribing is allowed or not.
I was expecting the above-described behavior or else I think it kind of defeats the purpose of the Admission hooks to some extent.
@Thunder80
Thanks for the great idea.
I think this is the role of "Control Server". OME can't decide whether to allow or deny reconnection (it would be rather inconvenient to refuse forever based on IP). The lifetime option literally means to force the broadcast to end after its lifetime. After that, when a reconnection request comes in, the Control Server can reject it.
For example, this could have the following use case:
When distributing an RTMP URL to a broadcaster, distribute the user's ID within the URL. rtmp://host/user_id (Of course, user_id should be a one-time encrypted string.)
And when user_id requests RTMP transmission, Control Server updates the user's db. And Control Server responds with the following normal transmission url and lifetime. rtmp://host/app/stream , lifetime=20min
If the user_id requests retransmission to the Control Server after transmission is finished, the Control Server can reject it {allowed: false}. (If the user has paid extra, Control Server will allow it again.)
Just run a test to check how everything is working. Is there a hook event for when client stops the incoming stream?
For example we might want to know when the client stops a rtmp stream so we can trigger some events based on that
At current implementation events are triggered only when incoming stream started, not when it ended.
@catapop84 Sorry for the late reply. I missed this question. AdmissionWebhooks were originally designed to only check permissions on inputs rather than trigger events. So there is Admission in the title. To trigger a shutdown event, you need to poll the API or analyze it through the log.
Will thumbnails get an admission check too?