Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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);
}
Copy link to clipboard
Copied
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?
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
I'm trying to use the admin api but I keep receiving error: netconnection.admin.commandfailed. I've verified the admin username and password are correct.
Is this the correct syntax to use? For example if I was trying to getUsers on this event.
My event path is : "C:\FMS\applications\livepkgr\_definst_\baseball"
In Internet Explorer I enter the following URL: http://localhost:1111/admin/getUsers?auser=admin&apswd=password&appInst="livepkgr/baseball/"
Thanks for the help.
Copy link to clipboard
Copied
Make sure under C:\Adobe Media Server 5\conf\Users.xml you have
-
And your server restarted after this edit.
Copy link to clipboard
Copied
Not sure what I'm supposed to have? Did you leave some information out?
Thanks!
Copy link to clipboard
Copied
-<AdminServer>
-<HTTPCommands>
<Enable>${USERS.HTTPCOMMAND_ALLOW}</Enable>
<Allow>getUsers</Allow>
<Deny>All</Deny>
<Order>Deny,Allow</Order>
</HTTPCommands>
</AdminServer>
Copy link to clipboard
Copied
Thanks. I checked and I already have those admin command permissions defined. Would this be the correct syntax to issue an admin command for my event called 'baseball'?
My event path is : "C:\FMS\applications\livepkgr\_definst_\baseball"
In Internet Explorer I enter the following URL: http://localhost:1111/admin/getUsers?auser=admin&apswd=password&appInst="livepkgr/baseball/"
Thanks!
Copy link to clipboard
Copied
Quotes aren’t mandatory - http://localhost:1111/admin/getUsers?auser=admin <http://localhost:1111/admin/getUsers?auser=admin&apswd=amspass&appInst=livepkgr/_definst_/baseball> &apswd=amspass&appInst=livepkgr/_definst_/baseball. Apart from that, physical folder location doesn’t always map to RTMP address you use when connecting.