# Decrypt encrypted urls and play

**URL:** <https://community.wowza.com/t/decrypt-encrypted-urls-and-play/35672>\
**Category:** Wowza Streaming Engine\
**Created:** [November 5, 2010, 5:56pm UTC](https://community.wowza.com/t/decrypt-encrypted-urls-and-play/35672 "2010-11-05T17:56:51Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jason\_B](https://avatars.discourse-cdn.com/v4/letter/j/7993a0/32.png) [@Jason\_B](https://community.wowza.com/u/Jason_B)\
**Post date:** [November 5, 2010, 5:56pm UTC](https://community.wowza.com/t/decrypt-encrypted-urls-and-play/35672/1 "2010-11-05T17:56:51Z")

</div>

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

```auto
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?

---

<div class="post-metadata">

**Author:** ![Andrew\_Kennedy](https://avatars.discourse-cdn.com/v4/letter/a/ecb155/32.png) [@Andrew\_Kennedy](https://community.wowza.com/u/Andrew_Kennedy)\
**Post date:** [November 5, 2010, 6:11am UTC](https://community.wowza.com/t/decrypt-encrypted-urls-and-play/35672/2 "2010-11-05T06:11:18Z")

</div>

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](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](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

---

<div class="post-metadata">

**Author:** ![Richard\_Lanham](https://avatars.discourse-cdn.com/v4/letter/r/c68b51/32.png) [@Richard\_Lanham](https://community.wowza.com/u/Richard_Lanham)\
**Post date:** [November 5, 2010, 11:17pm UTC](https://community.wowza.com/t/decrypt-encrypted-urls-and-play/35672/3 "2010-11-05T23:17:49Z")

</div>

You can use IMediaStreamNameAliasProvider2

> [@m4v http streaming](http://community.wowza.com/t/-/146):
>
> We are able to stream m4v file via rtmp and rtsp and I was trying to add http. I am confused about all the httpstreamers and what function they perform in file playback mode. All I want to do is intercept the http stream and play alias requests like we do for rtsp/rtmp. Specifically I am trying to stream to iphone and android phones. I was looking at using IModuleOnHTTPSession on top of the other IModuleOn interfaces we already use. What streamer should I use for VOD type streaming to iOS and A…

Richard

---

<div class="post-metadata">

**Author:** ![Richard\_Lanham](https://avatars.discourse-cdn.com/v4/letter/r/c68b51/32.png) [@Richard\_Lanham](https://community.wowza.com/u/Richard_Lanham)\
**Post date:** [November 12, 2010, 4:38pm UTC](https://community.wowza.com/t/decrypt-encrypted-urls-and-play/35672/4 "2010-11-12T16:38:34Z")

</div>

Change this:

```auto
String newName = "Extremists.m4v";

```

To this:

```auto
String newName = "mp4:Extremists.m4v";

```

Richard

---

<div class="post-metadata">

**Author:** ![Andrew\_Kennedy](https://avatars.discourse-cdn.com/v4/letter/a/ecb155/32.png) [@Andrew\_Kennedy](https://community.wowza.com/u/Andrew_Kennedy)\
**Post date:** [November 12, 2010, 8:39am UTC](https://community.wowza.com/t/decrypt-encrypted-urls-and-play/35672/5 "2010-11-12T08:39:02Z")

</div>

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

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

```

then in your module have

```auto
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

---

<div class="post-metadata">

**Author:** ![Jason\_B](https://avatars.discourse-cdn.com/v4/letter/j/7993a0/32.png) [@Jason\_B](https://community.wowza.com/u/Jason_B)\
**Post date:** [November 5, 2010, 11:37pm UTC](https://community.wowza.com/t/decrypt-encrypted-urls-and-play/35672/6 "2010-11-05T23:37:04Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Jason\_B](https://avatars.discourse-cdn.com/v4/letter/j/7993a0/32.png) [@Jason\_B](https://community.wowza.com/u/Jason_B)\
**Post date:** [November 12, 2010, 5:55pm UTC](https://community.wowza.com/t/decrypt-encrypted-urls-and-play/35672/7 "2010-11-12T17:55:42Z")

</div>

So I added the below module to Application.xml.

```auto
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

```auto
<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?
