Wowza Community

Re-streaming a dynamic RTSP stream based on a query string

Hi,

I want to re-stream a dynamic RTSP stream which I get from a third party service, based on a username, password and some other parameters.

I call VLC like this:

rtsp://wowza-ip:1935/live/[appInst]/[COLOR="#FF0000"]someUniqueStreamName.stream[/COLOR]?user=xxx&password=xxx&otherParams..

The file someUniqueStreamName.stream does not exist at this point.

On Wowza I defined the following Module:

public class LiveModule extends ModuleBase {
	public void onRTPSessionCreate(RTPSession rtpSession) {
		String queryString = rtpSession.getQueryStr();
		
		// call 3rd party service with the params from queryString
		
		// get a rtsp stream like this from the 3rd party service:
		// rtsp://ec2-xxxx.amazonaws.com:1935/live/xxx.stream?someParams
		
		// based on the above rtsp stream, create the [COLOR="#B22222"]someUniqueStreamName.stream[/COLOR] file on disk, containing the above rtsp stream
		
		appInstance.startMediaCasterStream([COLOR="#B22222"]someUniqueStreamName.stream[/COLOR], "rtp");
	}
}

In other words, I want to create the someUniqueStreamName.stream file on-the-fly, then watch its dynamically generated content in VLC. But it just doesn’t work. I get the error "Your input can’t be opened:

VLC is unable to open the MRL" in VLC. The file someUniqueStreamName.stream gets created properly with the proper rtsp url from the 3rd party.

Exactly the same on-the-fly stream file creation approach works great for HLS streaming and I can watch the stream on iOS. I have defined the following in the same module:

public class LiveModule extends ModuleBase {
	public void onHTTPSessionCreate(IHTTPStreamerSession httpSession) {
		String queryString = httpSession.getQueryStr();
		
		// same code as above
	}
}

I hope you get the idea of what I need to achieve. I’m not sure whether my approach is the proper one or I should change to another one.

Thank you in advance for any advice.

Ciprian

Take a look at this API for for aliasing stream names:

How to use the IMediaStreamNameAliasProvider2 interface

Salvadore