Page 1 of 2 12 LastLast
Results 1 to 10 of 15

Thread: Detect if a stream goes online or offline

  1. #1
    Join Date
    Sep 2012
    Posts
    21

    Default Detect if a stream goes online or offline

    If I want to start a webcam platform with multiple cams, is there a module or which module can I use to detect if a stream goes online or offline, so I can save the status to a database? Is something possible or is there a module that can do this?

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

    Default

    Take a look at IMediaStreamActionNotify.onUnPublish():

    http://www.wowza.com/forums/content....es-codec-info)

    Refer to this post for database connectivity in Wowza:
    http://www.wowza.com/forums/content....mySQL-database

    Don't over-use JDBC connections in Wowza. A quick connect in the onUnPublish handler should be okay.

    And take a look at the IOPerformanceCounter in the Wowza API.

    Richard

  3. #3
    Join Date
    Sep 2012
    Posts
    21

    Default

    What is the best method to call an url, for example: http://domainname/online?streamname=name in the onPublish and onUnpublish methods? Is this possible in that module? I need to ping a node js server to notify it if a cam is online or not.

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

    Default

    Take a look at the HTTPUtils api in the Wowza api. Use with caution, http calls are not recommended. It would be best if you not make Wowza wait, make the call and, if necessary, process a response in its own thread. If you must process a response to proceed, that is where things get dicey with http calls.

    Richard

  5. #5
    Join Date
    Sep 2012
    Posts
    21

    Default

    Something like the following would do, without problems? I don't have to process the response.

    try {
    URL url = new URL("http://www.example.com");
    try {
    HttpURLConnection con = (HttpURLConnection) url.openConnection();
    } catch(IOException e) {
    System.out.println("IOException: " + e.getMessage());
    }

    } catch(MalformedURLException e) {
    System.out.println("MalformedURLException: " + e.getMessage());
    } }

    The above doesn't seem to work and the following also doesn't work":

    HTTPUtils.HTTPRequestToByteArray("http://www.example.com/test.php","GET","wowza="+streamName,null);
    Last edited by rubensd; 05-07-2013 at 10:16 AM.

  6. #6
    Join Date
    Sep 2012
    Posts
    21

    Default

    If i use the post method:

    HTTPUtils.HTTPRequestToByteArray("http://www.example.com/test.php","POST","wowza="+streamName,null);

    it is working like a charm!

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

    Default

    [removed]
    Last edited by rrlanham; 05-08-2013 at 07:00 AM.

  8. #8
    Join Date
    Sep 2012
    Posts
    21

    Default

    Well, this looks very good, but is it possible to open a new thread in the IMediaStreamActionNotify onUnpublish and unPublish events, because then the stream is published and unpublished for sure.

    I mean what happens if the publish function is invoked (the HTTPWorker is also invoked), but it returns an error. Now the stream isn't working but the stream in the database is set to being live.

    Can I be sure that when publish is invoked, the stream is really wokring?

    What function can I use for unPublish? I couldn't find an unPublish function, only something like deleteStream or closeStream?

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

    Default

    You can use IMediaStreamActionNotify3 events (including .onPublish and .onUnPublish):

    http://www.wowza.com/forums/content....es-codec-info)

    Richard
    Last edited by rrlanham; 05-08-2013 at 06:41 AM.

  10. #10
    Join Date
    Sep 2012
    Posts
    21

    Default

    Ok thanks, now I see how it works, just have to add the following class: public class HTTPWorker implements Runnable to the Module base where the actionnotifier also is. Many thanks!

Page 1 of 2 12 LastLast

Similar Threads

  1. How to check if stream (transcoding) is online or offline?
    By HonyIceman in forum Wowza Streaming Server Java API
    Replies: 6
    Last Post: 06-10-2014, 01:56 AM
  2. Detecting an offline incoming live stream
    By karlrasche in forum Server-side Modules and Code Samples Discussion
    Replies: 1
    Last Post: 03-10-2014, 11:14 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
  •