Hi,
The easiest way to do this will be to implement the ILiveStreamTranscoderActionNotify interface which has a method, onInitBeforeLoadTemplate(LiveStreamTranscoder liveStreamTranscoder);, which is called right before the template is loaded. In this method, you can specify the name of the template that you want to load.
To implement the interface, you can do the following.
[PHP]
// Add a Transcoder listener to the appInstance.
appInstance.addLiveStreamTranscoderListener(new MyTranscoderCreateNotifier());
. . .
// Listener class that listens for transcoder create events and registers the transcoder action notifier class.
class MyTranscoderCreateNotifier implements ILiveStreamTranscoderNotify
{
@Override
public void onLiveStreamTranscoderCreate(ILiveStreamTranscoder liveStreamTranscoder, IMediaStream stream)
{
((LiveStreamTranscoder)liveStreamTranscoder).addActionListener(new MyTranscoderActionNotifier());
}
@Override
public void onLiveStreamTranscoderDestroy(ILiveStreamTranscoder liveStreamTranscoder, IMediaStream stream)
{
}
@Override
public void onLiveStreamTranscoderInit(ILiveStreamTranscoder liveStreamTranscoder, IMediaStream stream)
{
}
}
// Listener class that listens for transcoder actions. This class extends LiveStreamTranscoderActionNotifyBase which already implements all of the ILiveStreamTranscoderActionNotify methods so you only override the methods you need.
class MyTranscoderActionNotifier extends LiveStreamTranscoderActionNotifyBase
{
// get the templateName from somewhere and set it here.
@Override
public void onInitBeforeLoadTemplate(LiveStreamTranscoder liveStreamTranscoder)
{
String templateName = “myStream.xml”;
liveStreamTranscoder.setTemplateName(templateName);
}
}
[/PHP]
You can also use this along side the transcoder control interface to control what actually gets transcoded.
Roger.