Results 1 to 6 of 6

Thread: Creating API - Retrieve status of single live stream and all live streams

  1. #1

    Post Creating API - Retrieve status of single live stream and all live streams

    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:

    <name>test</name>
    <isLive>true</isLive>
    <liveViewers>5</liveViewers>
    <liveDuration>60</liveDuration>
    <name>test2</name>
    <isLive>true</isLive>
    <liveViewers>10</liveViewers>
    <liveDuration>120</liveDuration>

    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.

    <Stream>
    <Name>test</Name>
    <SessionsFlash>2</SessionsFlash>
    <SessionsCupertino>0</SessionsCupertino>
    <SessionsSanJose>0</SessionsSanJose>
    <SessionsSmooth>0</SessionsSmooth>
    <SessionsRTSP>0</SessionsRTSP>
    <SessionsTotal>2</SessionsTotal>
    </Stream>
    <Stream>
    <Name>Luke+the+Duke%27s+Firey+Funhouse</Name>
    <SessionsFlash>0</SessionsFlash>
    <SessionsCupertino>0</SessionsCupertino>
    <SessionsSanJose>0</SessionsSanJose>
    <SessionsSmooth>0</SessionsSmooth>
    <SessionsRTSP>0</SessionsRTSP>
    <SessionsTotal>0</SessionsTotal>
    </Stream>

    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!!
    Last edited by shadowprotocol; 12-04-2011 at 09:59 PM.

  2. #2
    Join Date
    Dec 2007
    Posts
    21,962

    Default

    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

  3. #3

    Default

    1) 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.

    2) 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 <Stream>). 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!!

  4. #4
    Join Date
    Dec 2007
    Posts
    21,962

    Default

    Right, this will allow CURL or whatever.

    Richard

  5. #5

    Default

    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!!

  6. #6
    Join Date
    Dec 2007
    Posts
    21,962

    Default

    You will have to add it. You can get source code for connectioncounts here:

    http://www.wowza.com/forums/content.php?184

    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
    http://www.wowza.com/forums/content....f-All-Articles

    Richard

Similar Threads

  1. Publish live streams using server side API (without .stream files)
    By AlexeyTs in forum Wowza Streaming Server Java API
    Replies: 9
    Last Post: 07-23-2014, 05:02 PM
  2. Combining multiple live audio streams into one single Stream instance?
    By videodoctor in forum Server-side Modules and Code Samples Discussion
    Replies: 1
    Last Post: 09-26-2013, 11:34 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •