This is a plugin to provide security for a rtmp stream, aswell as to provide accurate logs of viewers.
To use the plugin, it must be built using the Wowza IDE, and installed, then Wowza needs to be configured to use it. Instead of compiling, the jar file can just be placed into the [install dir]/lib/ folder.
Once the server is setup for streaming, and it has been verified to stream successfully, we can configure it for this plugin.
In the Application.xml config file for our stream, we start by adding this module to the end of the Modules list.
<Module> <Name>RTMPStatsandSecurity</Name> <Description>RTMP Statistics and Security</Description> <Class>guildtv.RTMPStatsandSecurity</Class> </Module>
Next we add these Properties to the Properties list, but change the values to suit your setup.
<Property> <Name>script</Name> <Value>http://live.guildtv.co.uk/stats/stat.php</Value> </Property> <Property> <Name>logScript</Name> <Value>http://live.guildtv.co.uk/stats/log.php</Value> </Property> <Property> <Name>streamName</Name> <Value>myStream</Value> </Property> <Property> <Name>referer</Name> <Value>https://live.guildtv.co.uk</Value> </Property> <Property> <Name>pageURL</Name> <Value>https://live.guildtv.co.uk/watch.php</Value> </Property>
Using the example file, create some pages to store and display the data being returned by wowza.
Using the example stats.php file, create a script that will return true or false depending on the validity of the key and associated ip address.
Use the watch.php as a sample script to generate and store keys.
You viewers must be sent to rtmp://live.guildtv.co.uk:1935/live/<unique key>. They will then be sent to the stream defined in the config file.
Finally we need to create a table in a database to store the keys.
CREATE TABLE `keys` ( `id` int(11) NOT NULL AUTO_INCREMENT, `key` varchar(50) NOT NULL, `ip` varchar(15) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `key` (`key`) );
You may want to think about controlling access to the statScript and the stats viewing, to protect the integrity of the data and the privacy of your users.