How to find all streams on a Wowza instance programmatically

This is a small snippet of code that demonstrates how to iterate through all applications in a vhost to eventually obtain each stream name within each application instance.

List appNames = vhost.getApplicationNames();
if(appNames.size()>0){
	Iterator appNameIterator = appNames.iterator();
	while (appNameIterator.hasNext())
	{
		String applicationName = appNameIterator.next();
		IApplication application = vhost.getApplication(applicationName); 
		
		List appInstances = application.getAppInstanceNames();
		if(appInstances.size()>0){
			Iterator iterAppInstances = appInstances.iterator();
			while (iterAppInstances.hasNext())
			{
				String appInstanceName = iterAppInstances.next();
				IApplicationInstance appInstance = application.getAppInstance(appInstanceName);
				
				List publishedStreams = appInstance.getPublishStreamNames();
				if(publishedStreams.size()>0){
					Iterator publishedStreamIterator = publishedStreams.iterator();
					while (publishedStreamIterator.hasNext())
					{
						String streamName = publishedStreamIterator.next();
						// getLogger().info("Your Stream: "+streamName);
					}
				}
			}
		}
	}
}

Comments are closed.