Decrypt encrypted urls and play

Hi,

I am trying to evaluate wowza for my streaming needs. I need to send an encrypted url, decrypt it at server and play the movie from the url name. From what I have understood so far

package com.unite.wms.module;
import com.wowza.wms.application.*;
import com.wowza.wms.amf.*;
import com.wowza.wms.client.*;
import com.wowza.wms.module.*;
import com.wowza.wms.request.*;
import com.wowza.wms.stream.*;
import com.wowza.wms.rtp.model.*;
import com.wowza.wms.httpstreamer.model.*;
import com.wowza.wms.httpstreamer.cupertinostreaming.httpstreamer.*;
import com.wowza.wms.httpstreamer.smoothstreaming.httpstreamer.*;
import java.security.*;
import java.math.*;
import java.lang.Long;
import java.lang.String;
public class Authorization extends ModuleBase {
    public void onConnect(IClient client, RequestFunction function, AMFDataList params)
	{
             try {
			// get flashvar variables
			String myHash= getParamString(params, PARAM1);
                       //connect to database here, check if supplied url is valid,check if user has access to play this movie and decrypt myHash to get movie path and name.
                       //How do I now pass this movie path to play it? 
             }
             catch(Exception e){
                      .....
             }
        }
}

So once I get the decrypted movie path, how do I play it? Also, this is the same procedure for iphone,ipad etc if the client uses a player?

have a look at the follow tutorials

StreamAlias package - Perhaps a little too indepth to start with but good to keep in mind for later

https://www.wowza.com/docs/how-to-get-the-streamnamealias-addon

RTMP override play - onConnect does not provide the filename so play is the place to look at the filename being used

https://www.wowza.com/docs/how-to-override-play-to-control-access

The iPhone one is a little different than RTMP and I can not find the example of how to change the filename requested, but when I do will post the URL.

Shamrock

You can use IMediaStreamNameAliasProvider2

Richard

Change this:

String newName = "Extremists.m4v";

To this:

String newName = "mp4:Extremists.m4v";

Richard

the problem is the file is mp4 format so for Wowza to choose the correct container format it needs the mp4: prefix. By default Wowza will assume FLV container so when it attempts to read the file as FLV it fails.

Perhaps the better example would be

<param name="Flashvars" value="bufferlength=2&streamer=rtmp://mylocalserver/simplevideostreaming&file=ANGRYMAN" />

then in your module have

package com.wowza.wms.plugin.streamnamealias;
import java.util.*; 
import com.wowza.wms.amf.*;
import com.wowza.wms.client.*;
import com.wowza.wms.module.*;
import com.wowza.wms.request.*;
import com.wowza.wms.stream.*;
import com.wowza.wms.application.*;
public class ModuleStreamNameAlias extends ModuleBase{
	public void play(IClient client, RequestFunction function, AMFDataList params)
	{
		String streamName = getParamString(params, PARAM1);
		// change stream name here
		String newName = "mp4:Extremists.m4v";
		params.set(PARAM1, new AMFDataItem(newName));
		invokePrevious(this, client, function, params);
	}
}

So any filename basically gets changed to the Extremists one.

Shamrock

Thanks a lot. Any pointers on how to combine the two codes? I don’t come from a Java background, so this all looks complicated.

So I added the below module to Application.xml.

package com.wowza.wms.plugin.streamnamealias;
import java.util.*; 

import com.wowza.wms.amf.*;
import com.wowza.wms.client.*;
import com.wowza.wms.module.*;
import com.wowza.wms.request.*;
import com.wowza.wms.stream.*;
import com.wowza.wms.application.*;

public class ModuleStreamNameAlias extends ModuleBase{
	public void play(IClient client, RequestFunction function, AMFDataList params)
	{
		String streamName = getParamString(params, PARAM1);

		// change stream name here
		String newName = "Extremists.m4v";
		params.set(PARAM1, new AMFDataItem(newName));

		invokePrevious(this, client, function, params);
	}
}

I am passing

<param name="Flashvars" value="bufferlength=2&streamer=rtmp://mylocalserver/simplevideostreaming&file=mp4:Extremists1.m4v" />

to the media server and trying to rewrite the stream to Extremists.m4v but it is not working. The wowza log says

INFO stream create - -

WARN server comment - MediaReaderFLV.open: Metadata appears to be bad: Extremists.m4v

INFO stream play Extremists.m4v -

If I remove the module and pass Extremists.m4v as variable to the JWplayer, it works fine. So what change do I have to do to make it working?