Jump to content
  • 0

How to get real-time updates of viewer count


Jianc
 Share

Question

Say you want to show the number of people are viewing the broadcast (one-way) for every viewers.

I would imagine for the app, we track when people join and leave, then update the counter in our own database.
But from my understanding, there's no webhook action for viewer connecting to and dropping from the webRTC connection, how would we do this accurately and in real-time too?

Another alternative is to make the server to get the video summary for every X seconds, but this is incredibly inefficient.

Am I missing something?

Thanks in advance!

Link to comment
Share on other sites

  • Answers 5
  • Created
  • Last Reply

Top Posters For This Question

5 answers to this question

Recommended Posts

  • 0
Hi,
Thank you for the great question. Ant Media Server Viewers Rest Services are listed below; 

serverip/WebRTCAppEE/rest/broadcast/getWebRTCClientStats/streamId 
serverip/WebRTCAppEE/rest/broadcast/get?id=streamId 

Also you can use these Rest Services in Webhook. Please let me know if you have any problem.
Have a nice Live Video Streaming Experience with Ant Media Server :-)

Best Regards,
Selim
Link to comment
Share on other sites

  • 0
Hi,
I misunderstood something. Sorry for that. The webhook structure is not suitable for the viewer. Actually, you can use the rest service to view the number of views on the video periodically.

serverip/WebRTCAppEE/rest/broadcast/getWebRTCClientStats/streamId 
serverip/WebRTCAppEE/rest/broadcast/get?id=streamId 

Please let me know if you have any problem.
Have a nice Live Video Streaming Experience with Ant Media Server :-)

Best Regards,
Selim
Link to comment
Share on other sites

  • 0
Hi @ibrahim,

Thank you for your question. You can access rest service in localhost. You must log in to the server for other connections.You can also delete the rest auth filter according to the below tutorial information

http://localhost:5080/LiveApp/rest/broadcast/get?id=streamId 

If you want to remove this rest filtering mechanism, please remove the below lines from webapps-> {Application} -> WEBINF -> web.xml

<filter>    <filter-name>RestAuthenticationFiler</filter-name>    <filter-class>io.antmedia.serverapp.pscp.filter.RestAuthenticationFilter</filter-class></filter><filter-mapping>    <filter-name>RestAuthenticationFiler</filter-name>    <url-pattern>/rest/*</url-pattern></filter-mapping>

After you remove the rest filter, you can access it with serverip.

http://serverip:5080/LiveApp/rest/broadcast/get?id=streamId 

If you have any question, please feel free to ask us.

Best Regards,
Selim
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share


×
×
  • Create New...