How can I get the viewer counter for each livestream

Hello api.video community,

I’m developing the Livestream app and using api.video as the main service, for now, I don’t know how to get the viewer counter for each Livestream, do we have any related API ?

Thanks,
Dai

Hi Dai,

Thanks for using our Live Streaming video API.

Today, you can use the Livestream analytics endpoint to get total views of the live stream (this is over every session in the range specified in the query).

However, I assume what you are looking for is the “watching now” count for the video. This is in development, and will launch soon.

Doug

Hi Doug,

Thanks for your feedback. Please inform us once you roll-out the api for “watching now” counter.

Dai

1 Like

Hello,

Is there any updates on this api ?

Dai

Hello,

Is there any news on this api ?

Dai

1 Like

Hi yes there is !

We have a blog post about view counters and it includes a link to a demo of a view counter as well.
Blog post - https://api.video/blog/tutorials/analytics-with-api-video
Demo - https://whoswatched.a.video/

Hello,

Thanks for the great Analytics feature, but it’s not something we need.

In fact, we need the Watching Now counter, which counts the real people who are watching our Livestream, not the total views.

Do you have something like that ? or a tutorial to help us implement this feature?

Thanks for your support,
Dai

Dai,

this will be a lot easier to implement when our webhooks are ready.

Using the live player sessions endpoint, you can get all sessions for a specific day. Each of those sessions have a session loadedAt and endedAt:

image

if you know the livestream start time, you can “+” all the sessions that have been created since the stream started, and “-” all the sessions that have ended. You’ll have to ping this endpoint periodically to get the count you want.

I’ll build a tutorial on this - but I’ll probably wait until we have webhooks on livestream: broadcast=true, and on analytics sessions.

Doug

Hello,

Many thanks for your quick responses, but I still have 2 questions below:

  1. Our application is using the device Player instead of api.video Player, does it count also with your webhook?
  2. Do you have any planing to roll out your webhook?

Regards,
Dai

Dai,

Currently all our viewer analytics are based around the player, so if you use the device player, we cannot help.

Webhooks for VOD encoding are underway right now and live/analytics are next on the list - so Q1.