Skip to main content
Participant
Jul 25, 2013 8:19 PM UTC
Question

Logs that show how many people watched a certain stream

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 is closed to new replies. Start a new post to keep the conversation going.

    9 replies

    Participant
    Jul 31, 2013 1:37 PM UTC

    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);

    }

    Translate
    Known Participant
    Aug 6, 2013 12:23 PM UTC

    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?

    Translate
    Participant
    Aug 6, 2013 12:31 PM UTC

    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.

    Translate