Results 1 to 4 of 4

Thread: How to invoke an external URL to notify events like onPlay, onDescribe, onTearDown.

  1. #1
    Join Date
    Sep 2013

    Default How to invoke an external URL to notify events like onPlay, onDescribe, onTearDown.

    How can i invoke an external URL (over http to notify the events) during various events like onPlay, onPause, onTearDown(), onDescribe, onAnounce() etc. Please share me a module code snippet.
    Thanks in Advance.

  2. Default


    Use the org.apache.http.client.HttpClient. Make sure you use the correct version of the library, as Wowza uses this library too, and using a different version than Wowza does, will cause a conflict. If I'm correct, it's version 3.1 you must use (at least that version works for me).

    String url = "http://my.external.url";
    HttpClient client = new DefaultHttpClient();
    HttpPost request = new HttpPost(url);
    // You can use to send JSON formatted data to your server
    Gson gson = new Gson();
    String json = gson.toJson(myObjectWithSerializableData);
    StringEntity params = new StringEntity(json);
    request.addHeader("content-type", "application/x-www-form-urlencoded");
    HttpResponse response = client.execute(request);
    BufferedReader reader = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
    String line = "";
    String data = "";
    while ((line = reader.readLine()) != null) {
        data += line;
    // Parse the response to an object, assumed that you get a response, and that it's JSON formatted
    MyResponseObject respObj = gson.fromJson(data, MyResponseObject.class);

  3. #3
    Join Date
    Sep 2013


    Hi karelboek,
    Thanks a lot for your response. I still have a small concern. If i have n number of RTSP sessions simultaneously, does the above code work. My concern is the stream which has invoked the http url should able to get the corresponding response. Will it work ?

  4. Default

    This is a synchronous call, so the HttpClient.execute will block and wait for response, so yes, the HttpResponse will always correspond to the HttpPost request.

Similar Threads

  1. What does onPlay/onStop mean at all?
    By maugzoide in forum General Forum
    Replies: 1
    Last Post: 11-03-2014, 05:38 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