Reputation: 793
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.
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
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