We have the following problem for two days now, for which we can’t find a solution either in the api or your forums:
In short, we need to rewrite the stream name at the start of a http session (iphone, win8, etc.), and we need to know when that particular session for which we did the rewrite gets destroyed (basically, when a client connects we want to rewrite stream A into stream B, and when he disconnects we want to know that he originally called stream A, so we can do some ‘cleanup’ for that name)
So far this is what we have (inside the same module)
-
IMediaStreamNameAliasProvider2 gives us the entry point to rewrite the stream name, and it works ok as is (resolvePlayAlias())
-
adding IHTTPStreamerSessionNotify gives us the create and destroy events for http sessions.
BUT, we’ve yet to figure out how to know on http session destroy that it was rewriten, and which one it was.
More precisely, if our wowza gets called with something like http://<server/…/streamA/Manifest,
-
resolvePlayAlias() gets called with a HTTPStreamerSessionSmoothStreamer object for the httpSession param - we return the rewritten stream name streamB after some checks/validations
-
onHTTPStreamerSessionCreate() gets called now with the rewritten stream name, BUT with a different httpSession param (and a different ConnectionHolder inside this httpSession) - at this point (and same issue for Destroy) we don’t know that the rewrite was from streamA, and not some other name, or even if it was rewritten.
we tried modifying members inside the httpSession received on resolvePlayAlias() (for instance, modifying the query member to include the original stream name) - but the changes don’t show in the httpSession object we receive on onHTTPStreamerSessionCreate.
of course, without implementing IMediaStreamNameAliasProvider2, nothing else gets called (neither one of onHTTPStreamerSessionCreate, onHTTPSessionCreate or onHTTPSmoothStreamingSessionCreate) as the initial stream name, streamA, is not valid -> so we can’t simply do the rewrite in either of them.
what we need to know is if there is a common/inherited object between the resolvePlayAlias() httpSession object and the one in onHTTPStreamerSessionCreate - anything that can tell us that the second call (onHTTPStreamerSessionCreate, or similar) comes from the same connection/user/whatever as the first call (resolvePlayAlias), so that we can then link this to the streamA-to-streamB rewrite…
…or if there is any other entry point for rewriting the stream name, apart from IMediaStreamNameAliasProvider2
public class qstreamer extends ModuleBase implements IMediaStreamNameAliasProvider2, IHTTPStreamerSessionNotify
{
public void onAppStart(IApplicationInstance appInstance)
{
...
appInstance.setStreamNameAliasProvider(this);
IVHost vhost = appInstance.getVHost();
HTTPStreamerContext httpStreamerContext = vhost.getHTTPStreamerContext();
HTTPStreamerSessions httpStreamerSessions = httpStreamerContext.getSessions();
httpStreamerSessions.addSessionListener(this);
...
}
public String resolvePlayAlias(IApplicationInstance appInstance, String name, IHTTPStreamerSession [B]httpSession[/B])
{
...
return streamB;
}
public void onHTTPStreamerSessionCreate(IHTTPStreamerSession [B]session[/B])
{
// we can't track that this call is made for the same 'client/connection' as the resolve call above as:
// - [B]session[/B] != [B]httpSession[/B] above
// - except for the stream name, any changes to [B]httpSession[/B] don't reflect in [B]session[/B]
}
public void onHTTPStreamerSessionDestroy(IHTTPStreamerSession [B]session[/B])
{
}
}