Hi,
I finally have my Wowza server setup in Amazon EC2 and it’s working well so far. I have been streaming to the server/live application using the stream name “test” to test and now I am looking to implement the next phase of my project: Getting Wowza server statistics.
Basically, what I want to achieve is the ability to query and return all of the streams that are online on the server.
For example, if I am streaming to rtmp://[my-ip-address]/live with the stream name “test” and my friend is also streaming to the same server using the stream name “test2”, I want the server to be able to tell me something like:
test
true
5
60
test2
true
10
120
I really wouldn’t focus on the above format too much, but hopefully it’s clear. I want to be able to retrieve the status of ONE individual LIVE stream, and also the status of EVERY LIVE stream on the server.
Thanks!!
EDIT
I did some research and found out that I can go to http://[my-ip-address]:8086/connectioncounts and it will tell me what streams are on, as seen below. I had my friend turn on a stream, and also tune into mine with me, which is why it says 2 viewers. This is great, as if you remember, I’m trying to easily display if a stream is ONLINE, DURATION, and VIEWERS.
test
2
0
0
0
0
2
Luke+the+Duke%27s+Firey+Funhouse
0
0
0
0
0
0
There are two problems here though. I need to type in a username and password from the admin.password file to access this information, and it does not tell me the duration of the individual stream.
How can I get the duration (or all of this information more easily?) and bypass the username/password needed, since I want to create a PHP API for this information!
Thanks!!
You can change this in /conf/VHost.xml /HostPort /Port “8086”. There are several HTTPProviders in this HostPort. Find the connectioncounts block:
<HTTPProvider>
<BaseClass>com.wowza.wms.http.HTTPConnectionCountsXML</BaseClass>
<RequestFilters>connectioncounts*</RequestFilters>
<AuthenticationMethod>admin-basic</AuthenticationMethod>
</HTTPProvider>
Then change AuthenticationMethod to “admin-basic” or “none”. With admin-basic you can put username password in url:
http://username:pwd@[wowza-address]:8086/connectcounts
Richard
Right, this will allow CURL or whatever.
Richard
You will have to add it. You can get source code for connectioncounts here:
https://www.wowza.com/docs/how-to-get-connection-counts-for-server-applications-application-instances-and-streams-with-an-http-provider
Some of the data you want might already be available, otherwise you might need to create an application Module or ServerListener that is running and keeping track of what you want, and can be queried by your modified connectioncounts
Here is a flat view of articles to browse
https://www.wowza.com/docs/
Richard
- Thanks Richard. So you are saying if I open that file while SSH is open on server, I can edit the file to allow access to connectioncounts using username and password in the URL?
That should work fine because I can probably create a CURL request using the full URL in PHP, which would keep my username and password hidden from site visitors.
- If the procedure from step 1 works, do you think I’ll have any problems with what I’m trying to achieve? Seems like I’ll be able to retrieve the output from connectioncounts, then parse it in a way that can rebuild a listing of all of the online streams (each entry in ). Looks like views will be easily acquired as well.
The last piece I need then is the duration. Is there a way I can determine for how long an RTMP Stream has been broadcasted live? Only name and views are reported in “connectioncounts”.
I don’t know Java, so if I have to modify code to display duration, could you help me with that? Thanks!!
Richard, you missed my question about getting stream duration for the second time. haha.
Do you have a solution for this? I would like to be able to determine how many seconds each stream has been on for, individually.
Thanks!!