HTTP Provider to inject metadata

This is a small http provider that will allow you to run http queries to inject metadata as needed. This is an alternative method from the generic flash example as provided by Wowza.

Set this up in your conf/VHost.xml just before the com.wowza.wms.http.HTTPServerVersion provider within the 8086 port as follows:

<HTTPProvider>
<BaseClass>guru.thewowza.HTTPInjectMetaData</BaseClass>
<RequestFilters>meta*</RequestFilters>
<AuthenticationMethod>none</AuthenticationMethod>
</HTTPProvider>

Then add the attached jar file to your lib/ folder and restart Wowza.  You can inject the metadata as follows:

http://[wowza-ip]:8086/meta?message=[text message]&application=[app-name]&stream=[stream-name]

If using JWPlayer, you would leverage their onMeta event handler to retrieve these meta events. Below is starter code to print all key/value pairs:

jwplayer("player-id").setup({   
        file: "rtmp://[wowzaip]:1935/[app]/[stream]" 
});
jwplayer("player-id").onMeta( function(event){ 
	for (var key in event) {
	   document.getElementById("metadata-output").innerHTML += "key: "+key+"<br>";
	
	   var obj = event[key];
	   for (var prop in obj) {
	      if (isNaN(prop))
	      { 
		   document.getElementById("metadata-output").innerHTML += prop + " = " + obj[prop] + "<br>";
	      } 
	   }
	}
});

Download Jar file and Source: HTTPInjectMetaData

 


Comments are closed.