Results 1 to 6 of 6

Thread: Adding a query string during run time

  1. #1

    Default Adding a query string during run time


    i was wondering if someone can help me with this,

    i am using a query string in the "streamer" url, based on which i calculate some values in onConnect()

    now, i would like to pass these calculated values as query string so that they can be used during onSessionDestroy(),

    i tried
    (getStream(client, function)).setQueryStr(qStr);
    in onConnect but it seems Stream is not created as yet

    So, I would like to know, how else i could set the query string so that it's available at sessionDestroy


  2. #2
    Join Date
    Dec 2007



    onConnect is the server-side of NetConnection.connect, so it is too soon to do that. You want to override play command, which is the server-side of


  3. #3


    Hi Richard,

    Thanks for your prompt response.

    it does solve my problem, but i was wondering what are the pros and cons of doing this in "play", could you please answer these, to help me figure out. btw, I am using the query string to authenticate the user, now using the query string i calculate some values which i need to pass to onSessionDestroy(), based on these passed values, some calculations are done and values are logged in the database.

    1. what are the events for which "play" is triggered, i suppose onConnect would be triggered only once, i am doing some heavy lifting in onConnect, if i move this to "play", i dont want the code to be executed unnecessarily ?

    2. how's sendStreamOnStatusError vs client.rejectConnection, can this be taken advantage of, in any way ?

    3. can this be done in onStreamCreate(), i can't seem to use setQqueryStr() to update the query string. how would i refuse authentication, is it using sendStreamOnStatusError() ?

    4. currently this is for RTMP, how would the things change in HLS? I suppose "play" is not intercepted there ?

    i am a beginner in streaming, please excuse if these questions sound silly.


  4. #4
    Join Date
    Dec 2007


    onConnect happens when the RTMP client does netconnection.connect, and play happens when the RTMP client does You can also use IMediaStreamActionNotify3 interface which includes onPlay and other stream events

    sendStreamOnStatusError sends notification to a RTMP client over the stream. The notification is listened for with the NetStream NetStatusEvent handler. It does not do anything really, except what your player chooses to do with that info.

    IClient.rejectConnection should only be used in the onConnect handler. After the connection has been established, use IClient.setShutdownClient(true).

    onStreamCreate is too soon for many things, including knowing a stream name or if it is being published or played. Use play or IMediaStreamActionNotify3.onPlay


  5. #5
    Join Date
    Dec 2007


    Also, for non-Flash RTMP clients, take a look at these examples:

    Also, normally you would use querystring to pass credentials to Wowza from the client, so it wouldn't be helpful to set them server-side. But you might want to store data in the client object for later.

    client.getAppInstance().getProperties().setProperty("var", "val");
    //later you can retrieve	
    String var = client.getAppInstance().getProperties().getPropertyStr("var");
    // or
    String var = stream.getClient().getAppInstance().getProperties().getPropertyStr("var");


  6. #6


    Just saw your second reply, that's quite like the intention here. I though, added the data that i wanted to pass as member variables for the class.

    A question here, is the app instance shared amongst different sessions ? or is it per session.

    and, what's the recommended practice ? i mean, having member variables (i have couple of ints) would be better in terms of memory(presuming properties would be stored as string) and cpu cycles, What's the advantage of using properties ?

Similar Threads

  1. MediaCache and query string
    By robw21 in forum General Forum
    Replies: 6
    Last Post: 04-18-2012, 12:33 PM

Posting Permissions

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