datarhei / restreamer

The Restreamer is a complete streaming server solution for self-hosting. It has a visually appealing user interface and no ongoing license costs. Upload your live stream to YouTube, Twitch, Facebook, Vimeo, or other streaming solutions like Wowza. Receive video data from OBS and publish it with the RTMP and SRT server.
https://docs.datarhei.com/restreamer/
Apache License 2.0
3.92k stars 448 forks source link

Can't obtain sessions info from API #749

Closed sincar74 closed 5 months ago

sincar74 commented 6 months ago

I all, this is my first post, and I want to thank you all for this amazing project

Subject of the issue I'm trying to get session information from API /api/v3/session, what I'm expecting is the number of current viewers connected to each channel, bandwidth tx, ..., but I always receive from API an all zero result:

{
  "": {
    "active": {
      "list": [],
      "sessions": 0,
      "bandwidth_rx_mbit": 0,
      "bandwidth_tx_mbit": 0,
      "max_sessions": 0,
      "max_bandwidth_rx_mbit": 0,
      "max_bandwidth_tx_mbit": 0
    },
    "summary": {
      "remote": {},
      "local": {},
      "reference": {},
      "sessions": 0,
      "traffic_rx_mb": 0,
      "traffic_tx_mb": 0
    }
  }
}

I'm honest, I didn't understand the meaning of the "collectors" parameter

Environment

Could you help me, please?

Thanks Sebastian

sincar74 commented 6 months ago

Hi, inspecting with developer tools on Restremer gui, I realize that "collectors" are parameters for which I want the session information. With collectors=hls I can retrieve what I'm searching for. To have the number of viewers then, I suppose that, I have to count the numbers of object that have the channels guid inside the reference property.

ioppermann commented 5 months ago

Yes, in the active.list you have count the objects that contain the channel ID in the reference in order to get the number of currently watching viewers.

sincar74 commented 5 months ago

Perfect, may thanks