Skip to main content
Participant
July 25, 2013
Question

Logs that show how many people watched a certain stream

  • July 25, 2013
  • 1 reply
  • 1615 views

Hello,

I apoligize if that has been asked and and answered before.

I recently got a request to see how many people watched a paticular stream. Now I don't really know much about FMS. We are running FMS 3.5 and I set it up many years ago and have not touched it since.

I am just wondering if their is any easy way to determine how many people watched a stream.

Thanks

    This topic has been closed for replies.

    1 reply

    Participant
    July 31, 2013

    Try admin api

    function timer1(){

        nc_admin.call("getLiveStreams", new onGetLiveStreams(), appName);

    }

    function onGetLiveStreams() {

        this.onResult = function(ans) {

         for (i = 0; i < ans.data.length; i++){

             nc_admin.call("getLiveStreamStats", new onGetLiveStreamStats(), appName , ans.data);

         }

        }

    }

    function onGetLiveStreamStats(){

        this.onResult = function(info) {

             if (info.data.publisher){

                trace("info.data.name = " + info.data.publisher.name);

            }

               if (info.data.subscribers){

                   //how many people watched a stream.

                   trace("info.data.subscribers.length = " + info.data.subscribers.length);

            }

        }

    }

    application.onAppStart = function (){

        nc_admin.connect("rtmp://localhost:1111/admin", "admin_login", "admin_pass");

        setInterval(timer1, 15000);

    }

    Known Participant
    August 6, 2013

    How would one implement these functions to display the current number of users watching a stream? I haven't used actionscript very much. Is there a way to display the number of users in the strobe media player?

    Participant
    August 6, 2013

    You can try to use these calls on client side.

    Also you can send subscribers.length from AMS to your server via LoadVars and read this value from your server.