Wowza Community

pseudo-live streaming from files in endless loop

I’m trying to figure out how to achieve the following in Wowza 4.01:

I have several mp4 files *

I want to pseudo-live stream in an endless loop (until manually stopped)

There will be about 6-12 hours of video material that will simply be live streamed (on a different/non Wowza server – this is important as I will not have access to any live streams for DVR style recordings, only the files as stated below) during the event, and will be re-encoded to HQ mp4 files from the original camera recordings after the event is finished. Now I would like to setup a channel/application that will “forever” (until stopped) keep streaming the file(s) (*) in a loop to any client that connects, so at the end of the file(s) it should automatically start over again from the beginning without disconnecting any clients – a short pause is ok, as long as the client doesn’t need to reconnect or restart playback.

output should be viewable by browsers, mobile clients, and bonus points when it also works on set-top boxes :wink:

I’ve used other streaming platforms before but I am new to Wowza, so any help on how to get this setup/working will be greatly appreciated!

  • in case several input files are a problem, these can also be encoded into a single file, so that there will only be a single input file

thanks.

This guide will show you how to achieve this:

How to do scheduled streaming with Stream class streams (StreamPublisher)

Salvadore

You can use JMX as shown here. This is how to setup JMX command line interface that you can use in your integration

Or you could use an HTTPProvider. This should provide the basic functionality found in the Module

package test;
import java.io.OutputStream;
import java.util.List;
import java.util.Map;
import com.wowza.wms.application.IApplicationInstance;
import com.wowza.wms.http.*;
import com.wowza.wms.logging.*;
import com.wowza.wms.plugin.collection.serverlistener.ServerListenerStreamPublisher;
import com.wowza.wms.server.Server;
import com.wowza.wms.stream.publish.Stream;
import com.wowza.wms.vhost.*;
public class HTTPReloadSchedule extends HTTProvider2Base {
	public void onHTTPRequest(IVHost vhost, IHTTPRequest req, IHTTPResponse resp) {
		if (!doHTTPAuthentication(vhost, req, resp))
			return;
		
		final String PROP_NAME_PREFIX = "streamPublisher";
		req.parseBodyForParams(true);
		
		Map<String, List<String>> params = req.getParameterMap();
		
		String action = "";
		String app = "";
		String report = "Nothing to do";
		
		ServerListenerStreamPublisher streamPublisher;
		IApplicationInstance appInstance = null;
		WMSLogger logger;
		
		streamPublisher = (ServerListenerStreamPublisher)Server.getInstance().getProperties().get(ServerListenerStreamPublisher.PROP_STREAMPUBLISHER);
		
		
		if (params.containsKey("action"))
			action = params.get("action").get(0);
		
		if (params.containsKey("app"))
		{
			app = params.get("app").get(0);
		}
		
		if (vhost.applicationExists(app)) {
			appInstance = vhost.getApplication(app).getAppInstance("_definst_");
		}
		
		if (action.equalsIgnoreCase("load"))
		{
			try {
				streamPublisher.loadSchedule(appInstance);
				report = "Schedule Loaded";
			} 
			catch (Exception e) {
				e.printStackTrace();
				report = "Load Schedule Error: " + e.getMessage();
			}
		} 
		else if (action.equalsIgnoreCase("unload"))
		{
			Map<String, Stream> streams = (Map<String, Stream>)appInstance.getProperties().remove(PROP_NAME_PREFIX + "Streams");
			if(streams != null)
			{
				for(Stream stream : streams.values())
				{
					streamPublisher.shutdownStream(appInstance, stream);
				}
				streams.clear();
			}
			report = "Schedule Unloaded";
		}
		
		String retStr = "<html><head><title>Schedule Loader</title></head><body><h1>Schedule Loader</h1>" + report + "</body></html>";
		try {
			OutputStream out = resp.getOutputStream();
			byte[] outBytes = retStr.getBytes();
			out.write(outBytes);
		} catch (Exception e) {
			WMSLoggerFactory.getLogger(null).error(
					"MediaCasterHTTP: " + e.toString());
		}
	}
}

If added to the first /conf/VHost.xml /HostPort (IpAddress 1935), make it 2nd to last HTTPProvider:

<HTTPProvider>
    <BaseClass>test.HTTPReloadSchedule</BaseClass>
    <RequestFilters>scheduleloader*</RequestFilters>
    <AuthenticationMethod>none</AuthenticationMethod>
</HTTPProvider>

Call like this:

http://[wowza-address]:1935/scheduleloader?action=load&app=live

Unload like this:

http://[wowza-address]:1935/scheduleloader?action=unload&app=live

Richard

Nothing that I am aware of. Someone from support might pick up on this question and provide a solution if there is one.

Salvadore

It sounds like from your last edit that you’ve sorted out the issue. Thanks for your update.

Hi wowza team,

You could update it to version 4.0.6, or pass detailed information on how I can insert through wowza streaming manager (web)?

EDIT: I made all the settings again, now working perfectly, probably some corrupted file or bad module compiled.

thank you for the link to the guide – it works just fine.

I have another related question: the guide states then changing the schedule/smil file, the application has to be notified to reload:

Use JConsole to connect to the JMX interface on your Wowza Media Server, and then run the loadSchedule operation directly on the module instance. In the MBeans tab, navigate to the AppInstance Modules/ModuleStreamPublisher/Instances/Operations tab, and then run the loadSchedule operation. An unloadSchedule operation is also available to shut down the streams.

I’d like to issue the reload notification from either a .net program (if code exists for that) or simply by calling a windows executable (if possible on another host that the wowza server). Is there an easy way to do this (without building a flash or java app)?