I would like to take a requested URL from a client and instead show them a video that is at a different location on the server.
How do I read the requested URL?
How do I set the location of the file to be streamed using the WMS SDKs and modules to something else?
I am currently using onRTPSessionCreate(RTPSession rtpSession) in a module and trying to find the url the client connected with over RTSP.
Thank you in advance for your help.
StreamNameAlias only concerns the stream name, not the URL.
Richard
You resolve the alias in one of the resolvePlayAlias methods, or resolveStreamAlias.
You might just need the StreamNameAlias addon which includes a mapping file that is used to resolve aliases
https://www.wowza.com/docs/how-to-get-the-streamnamealias-addon
Richard
Then you have to resolve the alias in one of the resolvePlayAlias methods, or resolveStreamAlias.
Richard
You have to return a real stream name or url. You play an alias, then resolve it. It might be rtsp or udp url, or another simple stream name, but you have to return an actual stream. In your case it is the contents of the .stream file you were using
Richard
The stream in that case is: udp://127.0.0.1:10000
Richard
Cool, glad it’s working. Thanks for the update
Richard
You can do that with the Stream Name Alias package.
I think I may have worded my question poorly. I would like to receive a URL similar to this, rtsp://192.168.1.22:1935/vod/videoID and then take the videoID, resolve the path to the file on the server, and return the video to the client without them knowing that the url is anything different than what they entered. On a different server I was able to receive the connection URL and change where the server was looking for the file it was streaming, giving it the correct local path on the server that corresponds to the videoID and then stream that file on demand to the client.
I chose to use the IMediaStreamNameAliasProvider2. Using this example I have been able to see the stream URLs that the client has sent, but I have yet to have success changing them. By the looks of the example code I should just need to return the new name. I tried to do this with my .stream files, but it is not working. How would I take a url and point it to a live video that is being sent over udp? I currently have a .stream file that contains
udp://127.0.0.1:port
and it works without aliasing.
I was reading through this forum thread and the last post points to what I need to do. I need to resolve a file location from a DB for VOD and I need to take a custom URL that is sent to a client from elsewhere and then resolve it to the correct URL for live.
I have started with live and I would like take a url from a client and point to a video coming over a udp connection like I was able to do with the .stream file. After looking at the thread I mentioned above I am coming to the understanding that the .stream files cannot be used with IMediaStreamNameAliasProvider2. If this is the case how would I take a stream name and point it to a udp URL without using the .stream file?
Thank you for your help so far Richard. After I have live working I will move on to VOD.
The StreamNameAlias package will not work because it requires a file and I need to resolve my VOD stream names from a DB.
You resolve the alias in one of the resolvePlayAlias methods, or resolveStreamAlias.
What should I be returning as a string for Live videos if not the UDP URL?
I understand I need to resolve the alias using one of those methods, but what should the string be that I am returning for a live video? I know it cannot be the .stream file so what should it be?
so would I return
rtsp://127.0.0.1:1935/Module/udp://127.0.0.1:10000
or
udp://127.0.0.1:10000
for a .stream file that contains
udp://127.0.0.1:10000
When I return that URL in the following code
//RTSP Stream name alias
@Override
public String resolvePlayAlias(IApplicationInstance appInstance,
String name, RTPSession rtpSession) {
System.out.println("**TEST RESOLVE PLAY ALIAS**");
getLogger().info("resolvePlayAlias RTP - Stream Name: " + name );
//name = "10000.stream";
//name = "udp://127.0.0.1:10000";
name = "udp://127.0.0.1:10000";
System.out.println("NAME: " + name);
return name;
}
@Override
public String resolveStreamAlias(IApplicationInstance appInstance,
String name, IMediaCaster mediaCaster) {
System.out.println("**TEST RESOLVE STREAM ALIAS**");
getLogger().info("resolveStreamAlias - Stream Name: " + name );
//name = "10000.stream";
name = "udp://127.0.0.1:10000";
//name = "udp://127.0.0.1:55600";
System.out.println("NAME: " + name);
return name;
}
I see the following output on the server when I try to connect to the rtsp URL using VLC open network stream.
INFO server comment - onRTPSessionCreate <IP>
INFO rtsp connect 909049332 -
**TEST RESOLVE PLAY ALIAS**
INFO server comment - resolvePlayAlias RTP - Stream Name: 10000
NAME: udp://127.0.0.1:10000
INFO stream create - -
INFO stream unpublish - -
INFO stream destroy - -
INFO server comment - onRTPSessionDestroy <IP>
INFO rtsp disconnect 909049332 -
The URL added to VLC was
rtsp://[HostName]:[Port]/[Module]/10000
With all the appropriate fields filled in
I think I have it working I missed the step of adding it to the stream manager after removing the .stream files. So I need to add in the stream URL to the Stream manager so that it will know how to handle the stream.
Thank you for all your help and your quick response.