Wayne
Wayne

Reputation: 793

Wowza error response on duplicate stream name

I am trying to edit the sample chat application provided by wowza to my needs. I want the application to automatically assign streamnames when the app load but do not want to allow duplicate stream names.

To do this here are my plans.

  1. Disallow in Wowza settings not to accept stream names if it is already existing from application.xml.
  2. Supply an auto numbered stream names on my app in the format of "stream_x" where x is a number
  3. Check if the automatically supplied stream names is existing on the server. If it is existing, try to increment stream number by one and try to publish again. Repeat the process until stream is no duplicate of existing stream.

For step number 3, I need to be able to grab the server response if the stream is already existing.

Looking at the code in the sample chat application provided by wowza, this is the part involve in publishing the stream name

    nsPublish = new NetStream(nc);       
    nsPublish.addEventListener(NetStatusEvent.NET_STATUS, nsPublishOnStatus);

I would like to know what is the error code I will receive in this line if the streamname is already existing in the server.

Im planning to make a loop below this line to increment my stream name until it becomes no duplicate of what's on the server already.

I checked their error codes here but did not find error related to duplicate stream name http://www.wowza.com/forums/content.php?277-How-to-troubleshoot-error-messages#server

Thanks

Upvotes: 0

Views: 221

Answers (1)

ikikenis
ikikenis

Reputation: 340

How about you create a stream with a random name without checking if already exists?

For example Timestamp + RandomNumber(X) would be good enough. For sake of shortening it, you could convert it to a Base58 string as well. Unless you get really unlucky (or have really high traffic) you have very little chance of name collisions.

Upvotes: 0

Related Questions