how to get the stream name of VOD stream?

Hi there,

I’m currently trying to insert onTextData to VOD stream. I referenced some other articles and wrote the following codes. But

when I called MediaStreamMap.getStream(stream name) it always returned NULL (marked in red). The mp4 file’s name is sample.mp4.

I also tried this code with live stream and it worked. I used ffmpeg to publish a stream named “myStream” to Wowza and then I called mediaStreamMap.getStream(“myStream”). It returned a non-null stream object and I successfully inserted onTextData to the stream (I used DVB inspector and saw the metadata packets)

So my question is: how to get the correct name of VOD stream? Shouldn’t it be sample.mp4 or mp4:sample.mp4?

public class AmfInjectorForVOD extends ModuleBase {

public static Timer timer;

public IApplicationInstance app;

private int InjectInterval = 5000;

public AMFDataObj timeObj;

public void onAppStart(IApplicationInstance appInstance) {

app = appInstance;

timeObj = new AMFDataObj();

timer = new Timer();

timer.schedule(new injectStreams(), InjectInterval, InjectInterval);

getLogger().info(“this is AmfInjector for VOD\n”);

}

public void onAppStop(IApplicationInstance appInstance) {

timer.cancel();

}

class injectStreams extends TimerTask{

public void run() {

getLogger().info("all the streams listed: " + app.getStreams().getStreams() + ‘\n’);

MediaStreamMap mediaStreamMap = app.getStreams();

IMediaStream vidStream = mediaStreamMap.getStream(“sample.mp4”);

if (vidStream != null){

injectEvent(vidStream);

} else {

getLogger().info("stream no found " + ‘\n’);

}

}

}

public void injectEvent(IMediaStream stream) {

AMFDataMixedArray data = new AMFDataMixedArray();

data.put(“text”, new AMFDataItem(“hello world VOD\n” + (new Date()).toString()));

data.put(“language”, new AMFDataItem(“eng”));

data.put(“trackid”, new AMFDataItem(99));

stream.sendDirect(“onTextData”, data);

getLogger().info("yshenCaption: " + “hello world\n”);

}

}

Thanks!

Yorick

Found the answer. Injecting AMF onTextData into a VOD RTMP stream?

Currently Wowza doesn’t support injecting onTextData to VOD stream. I also checked the MediaStreamMap object in my code. The “streams” field in this object is NULL.