Hi folks,
I use WMSPanel to secure my streams, but I’m facing a situation where I need to apply different rules to the same cupertino stream, whether it’s being sent to a mobile device or a desktop.
I can see a few ways to do this, but I’d like to check first if anybody has done this, or has any better advice
- Create two applications (livetv and mobiletv). Use the stream manager for application mobiletv to connect to rtmp://localhost:1935/livetv/MyStream
Though I have WMSauth protection on the RTMP output, I presumably could whitelist 127.0.0.1 so it’s not required?
- Use StreamNameAlias module to create a different version of the stream, so for example livetv/MyStream and livetv/MyStream-mobile
But I’m not sure, if the alias is set up, the the stream still accessible from its original name?
-
Send two input streams, one to each application. By far the simplest way, but quite wasteful of bandwidth!
-
Use separate instances under one application? I’m really not sure if this would work, but if I send the stream to server/livetv/MyStream, would it be accessible from server/livetv/web/MyStream and server/livetv/mobile/MyStream?
-
Some hidden setting in wowza to allow two applications to share an input stream?
Anyway I will do some experimenting with this now, will report back here but would really appreciate any insight!
Can you explain what you mean by apply different rules to the same stream?
Do you need different bitrates or different authentication rules?
Salvadore
Two different authentication rules, specifically a longer validity for the authentication code, as it won’t be generated each time a stream is launched, but each time the app is opened.
Also it would allow me to tweak the packetization, etc, separately
Well, turns out this was unnecessary…
My primary concern was to apply different validity periods to the WMSAuth links. But I forgot that this validity period is set from the PHP side and not from Wowza, so in the end I can still use the same application/streams facepalm
Hi,
Option 1 or option 2 would be the best, depending on what it is that you want to do.
Option 1 would give you 2 completely separate streams on separate application or appInstances so you can packetize separately and apply different rules.
Option 2 would use the same source stream so it would only be packetized once. You could apply different rules to each alias. You should be able to block access to the original stream name quite easy by removing the default rule.
Another option is to use the Stream api and create a second stream dynamically from the first one when it is published. It would be fairly simple to do and would be automatic.
The following snippet shows the IMediaStreamActionNotify2.onPublish & onUnPublish methods that you would use.
@Override
public void onPublish(IMediaStream stream, String streamName, boolean isRecord, boolean isAppend) {
if(streamName.endsWith("-mobile"))
return;
Stream mobileStream = Stream.createInstance(stream.getStreams().getAppInstance(), streamName+"-mobile");
if(mobileStream != null)
{
mobileStream.play(streamName, -2, -1, true);
stream.getProperties().setProperty("mobileStream", mobileStream);
}
}
@Override
public void onUnPublish(IMediaStream stream, String streamName, boolean isRecord, boolean isAppend) {
if(streamName.endsWith("-mobile"))
return;
Stream mobileStream = (Stream) stream.getProperties().remove("mobileStream");
if(mobileStream != null)
{
mobileStream.close();
}
}
This will publish the second stream with -mobile added to the name to the same appInstance. This will then get packetized separately so you could apply different settings.
Roger.