Ant Media Server provides webhooks for making your system/app know when certain events
Register Your Webhook URL
You can add default webhook URL to your streaming app on Ant Media Server. In addition, it lets you add custom specific webhook URL’s in creating broadcast.
Add default Webhook URL
In order to add default URL, just follow the steps below
- Open your apps red5-web.properties and add settings.listenerHookURL property to that file. red5-web.properties file is under webapps/<app_name>/WEB-INF folder
... settings.listenerHookURL=http://www.example.com/webhook/ ...
- For 1.6.0 and earlier versions, open your apps red5-web.xml file and add settings.listenerHookURL to the app.settings bean.
... <bean id="app.settings" class="io.antmedia.AppSettings" > ... <property name="listenerHookURL" value="${settings.listenerHookURL}" /> ... </bean> ...
- Restart the server on
command linesudo service antmedia restart
Right now, there is a default webhook URL for your app.
Add Custom Webhook for Streams
Ant Media Server provides creating streams through rest service. Therefore, If you want to specify the webhook URL for each stream, you can use
Here is a sample JSON for using
Webhooks List
It’s time to know when Ant Media Server calls webhooks with which parameters. Here is a simple list for that
- liveStreamStarted: Ant Media server calls this hook when a new live stream is started. It sends POST (application/x-www-form-
urlencoded ) request to URL with following variables- id: stream id of the broadcast
- action: “liveStreamStarted”
- streamName: stream name of the broadcast. It can be null.
- category: stream category of the broadcast. It can be null.
- liveStreamEnded: Ant Media Server calls this hook when a live stream is ended. It sends POST(application/x-www-form-
urlencoded ) request to URL with following variables.- id: stream id of the broadcast
- action: “liveStreamEnded”
- streamName: stream name of the broadcast. It can be null.
- category: stream category of the broadcast. It can be null.
- vodReady: Ant Media Server calls this hook when the recording of the live stream is ended. It sends POST(application/x-www-form-
urlencoded ) request to URL with following variables.- id: stream id of the broadcast
- action: “vodReady”
vodName :vod file name
That’s all. As a result, you can take some custom actions according to your project by checking
We hope this post will help you to make automation in your project. Please keep in touch if you have any question. We will be happy if we can help you.