Previously I have used the MediaCaster API to reset the active streams.
Using the knowledge of this threads
https://www.wowza.com/docs/how-to-use-the-wowza-streaming-engine-java-api-to-start-and-stop-mediacaster-streams - How to use the MediaCaster API
https://www.wowza.com/forums/showthread.php?9999-Coding-the-Stream-Manager - using the Richard’s post
Now I’m trying to create method to start the stream and I encounter the following issue.
First using the Engine Manager an application is created.
When I call my method for starting the stream
[INDENT]IVHost vhost = VHostSingleton.getInstance(VHost.VHOST_DEFAULT);
IApplication app = vhost.getApplication(appName);
try[/INDENT]
[INDENT][/INDENT]
[INDENT]{[/INDENT]
IApplicationInstance applicationInstance = application.getAppInstance(application.getAppInstanceNames().get(0));
applicationInstance.startMediaCasterStream(streamName, mediaCasterType);
}
catch (Exception e)
{
//
}
A null pointer exception happens where I try to get the appInstance (application.getAppInstance(application.getAppInstanceNames().get(0));), same happens with (app.getAppInstance(“definst”);), because the instance hasn’t been created yet.
If I manually start the stream from stream manager it does start and after using my method can start second stream without problem after the instance is created, but I can’t use this because if I have to manually start the instance then I won’t need this method.
How is the stream started using the stream manager, how it can start it without the instance (definst) being already created?
Regards,
which also does not work if the instance is not active.