Wowza Community

How to control access to an RTSP/RTP stream

https://www.wowza.com/docs/how-to-control-access-to-rtsp-rtp-streams

Is onRTPSessionCreate() part of some patch on top of Wowza Pro 2.0.0.0?

If you start a stream using StartupStreams.xml it will continue to try to connect to the source as long as the server is running. You have locked the stream server-side so it will continue to try to connect to it. You can use the IApplicationInstance.stopMediaCasterStream method to stop the stream or you can stop it using the Stream Manager (http://[wowza-ip-address]:8086/streammanager) or through the JMX command line interface or the SOAP interface (lots of options).

Charlie

We do not have a way to re-write URLs like this. If the key is after the application and appInstance name then you can rewrite the URL by overriding the play command. The basic URL structure is:

rtmp://[domain]/[application]/[appInstance]/[stream-path-and-name]

You can do anything you like to re-write the [stream-path-and-name] part. The first 3 bits are required.

So you can more your security key. The URL would be more like:

rtmp://localhost:1935/vod/definst/MjIhMTI4MDgyMjM5MyEzNjAwIVghZXVyb25/Extremists.flv

Charlie

I don’t think so, it should be in Wowza 2.0.0.0

But it’s a good idea to apply the latest patch. There are rtsp related fixes and enhancements in recent patch releases:

http://wowza.com/devbuild.html

Richard

Use onRTPSessionCreate instead of onConnect. See this post:

http://www.wowza.com/community/t/-/69

Richard

onRTPSessionCreate fires when you start playing a stream from an RTSP device or player. For example VLC using a rtsp url to a Wowza Stream.

You can add a querystring to the rtsp url and retrieve in onRTPSessionCreate with:

String queryStr = rtpSession.getQueryStr();

Richard

You need an application named myModules, and you need to an Application.xml file with at least one modification, and you need to include a stream name.

Call the application “vod”, and create it by adding this folder:

/applications/vod

To configure it by adding this folder:

/conf/vod

Then copy /conf/Application.xml to /conf/vod/Application.xml

Make one edit in the new file: Change /RTP /Authentication /PlayMethod from “default” to “none”

Now play this in VLC:

rtsp://[wowza-address]:1935/vod/sample.mp4

This will run onRTPSessionCreate

You should go through the quickstart, User Guide and various tutorials on this forum

Richard

RTMP connection will not trigger onRTPSessionCreate because it’s not an RTP session. RTMP connection triggers onConnect

public void onConnect(IClient client, RequestFunction function,
			AMFDataList params) {
		getLogger().info("onConnect: " + client.getClientId());
	}

HTTP session: onHTTPSessionCreate

RTP session: onRTPSessionCreate

RTMP connection: onConnect

Richard

btw, you have past the scope of the “quickstart” guide. There is more in depth information in the sticky posts of the Helpful Hints, Useful Code Forum section:

http://www.wowza.com/community/c/-/10

There is a lot to digest.

Richard

I accidentally copied in onConnectReject above, but corrected it to onConnect

Richard

Hi,

If the session is started in the StartupStreams.xml, the method rtpSession.rejectSession(); don’t stop the auto-reconnection(the rtsp session will automatically start if you use limited rtsp sessions) of session (i tested)…

Some one know another way stop the auto-reconnection in rtsp sessions?

thank you,

barros

Hi everyone,

I’m very new to working with Wowza, so please bear with me.

We’re trying to control access in a different way from what is being discussed in this thread. We want to include a key parameter in the RTSP link, and then do some checks with some sort of plugin before allowing access.

So I suppose the link would be something like this:

RTSP:///&key=1234

I am working with a sample module:

public class MyFirstModule extends ModuleBase {
public void onConnect(IClient client, RequestFunction function,AMFDataList params) {
//my code is here
}

I can trigger this by opening MyFirstModule.html in a browser, but I cannot add any parameters to it that way. It calls the onConnect method with “RTMP://localhost/mymodules”.

I’ve read the quick start guide, the javadoc, and all the other documentation I could find, but I’m still struggling to get started with this.

So I have several questions:

  • Am I on the right track using the onConnect method for this?

  • How can I test what I have done so far? I.e. how can I put a key in the URL?

  • Is what I am trying to do feasible?

  • Is there some architectural overview of how things work in Wowza? Some UML diagrams showing the sequence of events when a request comes from a client, would be very useful.

Thanks in advance for your help.

How and when is onRTPSessionCreate triggered? I never get into that method.

What about adding parameters to the URL?

I tried this in VLC:

rtsp://localhost:1935/mymodules

VLC gives the following error:

VLC is unable to open the MRL ‘rtsp://localhost:1935/mymodules’. Check the log for details.

Wowza only logs the following:

WARN server comment - Application folder ([install-location]/applications/defapp) is missing

It doesn’t trigger anything in my module.

:confused:

Hi,

If I use VLC player to open:

“rtsp://localhost:1935/vod/sample.mp4”

Then RTPSessionCreate is triggered, and it executes my code as intended. :slight_smile:

However, if I use FLV player to open:

rtmp://localhost:1935/vod/Extremists.flv

The video just plays, and RTPSessionCreate is never triggered, my code never runs, and that is not good. :mad:

I would therefore reiterate my request to know what is triggered when, and how, and why. Or at this stage, I will gladly settle for any pointers that would get this working properly.

I just need my code to be triggered whenever anybody anywhere tries to play any clip or anything else, in any way shape or form, on my wowza server. Shirley this shouldn’t be so hard. :confused:

Again, I have read every word in the quickstart guide 3 times, and followed instructions to a T.

Ohhhh… now that makes sense.

Shows how much I know about this stuff :rolleyes:

Thanks for the help!

Quick question

If the client tries to open the following URI (in VLC player)

rtmp://localhost:1935/MjIhMTI4MDgyMjM5MyEzNjAwIVghZXVyb25/vod/Extremists.flv

it will fail because the key is there in the URI, so it looks for the file in the wrong place.

How can I tell Wowza to ignore the key, and just treat it like

rtmp://localhost:1935/vod/Extremists.flv

Should calling client.setUri() do it? Or what would you suggest?