# how to get the stream name of VOD stream?

**URL:** <https://community.wowza.com/t/how-to-get-the-stream-name-of-vod-stream/44757>\
**Category:** Wowza Streaming Engine\
**Created:** [March 23, 2015, 7:19pm UTC](https://community.wowza.com/t/how-to-get-the-stream-name-of-vod-stream/44757 "2015-03-23T19:19:56Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yuxiang\_Shen](https://avatars.discourse-cdn.com/v4/letter/y/278dde/32.png) [@Yuxiang\_Shen](https://community.wowza.com/u/Yuxiang_Shen)\
**Post date:** [March 23, 2015, 7:19pm UTC](https://community.wowza.com/t/how-to-get-the-stream-name-of-vod-stream/44757/1 "2015-03-23T19:19:56Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Yuxiang\_Shen](https://avatars.discourse-cdn.com/v4/letter/y/278dde/32.png) [@Yuxiang\_Shen](https://community.wowza.com/u/Yuxiang_Shen)\
**Post date:** [March 23, 2015, 9:46pm UTC](https://community.wowza.com/t/how-to-get-the-stream-name-of-vod-stream/44757/2 "2015-03-23T21:46:09Z")

</div>

Found the answer. [Injecting AMF onTextData into a VOD RTMP stream?](http://community.wowza.com/t/-/42130)

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.
