srs
srs copied to clipboard
Need current number of client in on_play/on_stop webhook body.
I think it's neccessary for having current number of client in on_play/on_stop webhook body. I have service that start run ffmpeg to publish stream when have client start play. If there is another plays then I do not start ffmpeg anymore. When the last client stop and I stop ffmpeg publishing. So to know the first client start stream and last client stop stream I need to know current number of client.
Thank you!
maybe you can check if the ffmpeg proccess is already started, and if is already estarted not start a new one? regards.
maybe you can check if the ffmpeg proccess is already started, and if is already estarted not start a new one? regards.
Your solution is ok with playing flow but stopping flow is not working. How can I know the last client stops stream so I can kill ffmpeg process without know number of client?
using this?: http://ip:1985/api/v1/clients/?count=100 or this: http://ip:1985/api/v1/streams/?count=100 maybe?
Implemented in v7.0.107
This feature has been implemented. The clients field is now available in:
-
Webhooks (
on_play/on_stop): Shows the current number of clients for the stream{ "action": "on_play", "clients": 3, ... } -
HTTP API (
/api/v1/streams): Addedtotalfield for total stream count{ "total": 10, "streams": [...] } -
HTTP API (
/api/v1/clients): Addedtotalfield for total client count{ "total": 25, "clients": [...] }
This allows you to detect the first client (when clients becomes 1) to start FFmpeg, and the last client (when clients becomes 1) to stop FFmpeg.