Wowza Community

How do i stop people leeching my streams?

Is there anyway i can stop people leeching my streams at all?

Have a look at this article:

How to combat hotlinking your Adobe Flash SWF file

Salvadore

Hi,

You will have to add the host name of the website hosting your player in this property as well:

domainLock

localhost,mysite.com

Zoran

Ive looked at that article and followed the instructions accept for the part about wirecast

domainLock

localhost,mysite.com

AllowEncoder

Wirecast

What is the proper method i have to input instead using wirecast i use Xsplit you see

So once ive filled in all the details on my application.xml how does that stop other sites leeching the stream exactly?

thats exactly what i mean i dont want my stream/swf file on other sites at all, but when i put the domain lock in and try to stream it doesnt allow me to

So is it the host name ONLY or my domain and my host name that i have to add??

Also when it says the saying “Compile this in the Wowza IDE” what does that actually mean as i dont understand it, how do i “Compile this in the Wowza IDE”

Also one last thing which Application.xml file needs editing as well please as theres more than 1 so is it the [install-dir]\conf >> The applicaion.xml file thats there or is it anywhere else?

So the 3 things i need answering is:

  1. So is it the host name ONLY or my domain and my host name that i have to add??

  2. when it says the saying “Compile this in the Wowza IDE” what does that actually mean as i dont understand it, how do i “Compile this in the Wowza IDE” as it says

“Here is a complete Wowza Module to deny hotlinking server-side. Compile this in the Wowza IDE:”

package com.wowza.wms.plugin.collection.module;
import com.wowza.wms.amf.*;
import com.wowza.wms.client.*;
import com.wowza.wms.module.*;
import com.wowza.wms.request.*;
public class ModuleHotlinkDenial extends ModuleBase {
	public void onConnect(IClient client, RequestFunction function,
			AMFDataList params) {
		
		getLogger().info("ModuleHotlinkDenial onConnect: " + client.getClientId());
  
		String flashver = client.getFlashVer().toLowerCase();
		getLogger().info("ModuleHotlinkDenial Client Flashver: " + flashver);
		
		try
		{ 
			String[] allowedEncoder = null;  
			    
			allowedEncoder = client.getAppInstance().getProperties().getPropertyStr("AllowEncoder","").toLowerCase().split(","); 
			if ( allowedEncoder != null )
				{ 
				for (int i = 0; i < allowedEncoder.length; i++) 
				{  
					if (flashver.startsWith(allowedEncoder[i].trim()) && allowedEncoder[i].length()>0) 
					{ 
						getLogger().info("ModuleHotlinkDenial Encoder Allowed: "+flashver+" matches "+allowedEncoder[i]); 
						client.acceptConnection();
						return;
					} 
				} 
			} 
		} 
		catch (Exception e) 
		{
			getLogger().info("ModuleHotlinkDenial Exception: " + e.getMessage()); 
		}
		boolean reject = true;
		String[] domainLocks = null;
		String[] domainUrl = null;;
			
		try 
		{ 
		domainLocks = client.getAppInstance().getProperties().getPropertyStr("domainLock").toLowerCase().split(",");
		String pageUrl = client.getProperties().getPropertyStr("connectpageUrl").toLowerCase();
		domainUrl = pageUrl.split("/");
		getLogger().info("domainLock: " + client.getAppInstance().getProperties().getPropertyStr("domainLock").toLowerCase());
		getLogger().info("pageUrl: " + pageUrl);
		for (int i = 0; i < domainLocks.length; i++)
		{ 
			if (domainLocks[i].trim().startsWith("*"))
			{
				String lock = domainLocks[i].trim().substring(1);
				if (domainUrl[2].endsWith(lock))
				{
					reject = false;
				}
			} 
			else if (domainUrl[2].equalsIgnoreCase(domainLocks[i].trim()))
			{
				reject = false; 
			}
		}
		} 
		catch(Exception ex)
		{
			reject = true;
		}
		if (reject)
		{
			getLogger().info("Client Rejected. IP: " + client.getIp());
			client.rejectConnection();
		}
	}
}

Where do i put the above code (like it says here: https://www.wowza.com/docs/how-to-combat-hotlinking-your-adobe-flash-swf-file) as i don’t understand what specific file i need to edit to put the above code in.

  1. which Application.xml file needs editing as well please as theres more than 1 so is it the [install-dir]\conf >> The applicaion.xml file thats there or is it anywhere else?

So if someone could answer all 3 and when answering put like

  1. answer …

  2. answer…

i would be ever so grateful

Thanks guys really appreciate it!

create a new class in eclipse called “ModuleHotlinkDenial”

Wheres ecplise and a new class how do i do that,

Sorry for the questions

Got it now guys thanks ever so much!!

The Value “FM” works in most cases. It is what the userAgent for FMLE 2.5, 3, 3.2 start with, and Wirecast and other encoders often use the same userAgent. If not, look in the access log and you see the userAgent of the encoder. Copy that to AllowEncoder Property Value.

Salvadore

You might also want to look at this article and see what other options are available for protecting your stream:

Media security overview

Salvadore

Can you explain what you mean by “leeching” exactly?

The hotlink denial module denies other websites from hosting your .swf file on their website.

Depending on what you mean by “leeching” this might not be what you need.

You can find more info and other options for protecting your stream here:

Media Security Overview

Salvadore

  1. you can add as many “allowed domains” (comma separated) as you like, “locahost, www.mysite.com” would be your local computer and your website.

  2. to compile the code, create a new class in eclipse called “ModuleHotlinkDenial” and past the code sample from the article:

How to combat hotlinking your Adobe Flash SWF file

Add the module to the Application.xml file, at the end of the modules list. Then in the IDE hit the green “run” button to compile the module and start Wowza.

Here is the Wowza IDE user guide, this will explain in much more detail how to do this:

Wowza IDE User Guide

  1. The Application.xml file in [install-dir]/conf is the default Application.xml file, any edits made to this file will propagate to all other apps that use this file. When creating new applications it is advised to copy the default Application.xml file into the install/conf/[app] folder and edit the copied Application.xml file.

Salvadore

The link I provided above to the Wowza IDE has a link to download Eclipse and also has the IDE User Guide.

Download and install Eclipse, then follow the IDE User Guide to start creating Wowza modules. The guide is very short and easy to follow, and will get you up and running very quickly.

Salvadore

Great, thanks for the update. Glad we could help.

Salvadore