inject custom metadata to video on demand stream server side at time intervels

I saw this link about how to modify the metadata of on-demand streams.

I can use that if i wanted to “modify” metadata in beginning of stream. But i need to “add” metadata dynamically on server-side at variable time-intervals( ie. client sends cue-points to server in-middle of playing the vod stream and server has to inject metadata with some custom keys to vod stream).

Below is my code inside cue-point method on server-side to send metadata to vod :

            List<IMediaStream> playStreams = client.getAppInstance().getPlayStreamsByName(vodStreamName);
	    AMFDataObj data = new AMFDataObj();
	    AMFDataArray parameters = new AMFDataArray();
	    parameters.add("param1");
	    parameters.add("param2");
	    data.put("testMetadata", parameters);
	    for(IMediaStream streamInstance:playStreams)
           {
	    	if(streamInstance != null)
		    {
	    		streamInstance.sendDirect("onMetaData", data);//working
		    	((MediaStream)streamInstance).processSendDirectMessages();
		    }
          }

I used the same code to send metadata to live(non-vod) streams, it works just fine. It doesn’t work in case of vod stream. Can anyone tell what’s wrong with my code? Any help is appreciated.

This method is for live streams. It will write cuepoints to recordings for later VoD playback, but does not write to VoD directly.

You can use a 3rd party injector, Captionate would be one option.

Salvadore

Hi,

Answered here.

Roger.

There is also a way to do this thru Wowza.

You can create a schedule to run VoD content as a live source, then use the LiveStreamRecord API to record the stream back to VoD with the metadata included. you will need to use the LiveStreamRecord API because a StreamType of “live-record” is not supported by Stream class Streams.

How to do scheduled streaming with Wowza Streaming Engine (StreamPublisher)

How to record live streams (HTTPLiveStreamRecord)

Salvadore

You were saying metadata and I was hearing cuepoints, that is my fault. Sorry for the confusion and I am glad to hear you got this working.

Thanks for the update.

Salvadore

Hi Salvadore,

I appreciate ur reply. It took a whole day for me to experiment the ways to send metadata in vod stream in real-time. It turned out that a simple modification in the code would do the trick.

Replacing below code

streamInstance.sendDirect("onMetaData", data);
((MediaStream)streamInstance).processSendDirectMessages();

with

streamInstance.send("onMetaData", data);

did the help to my purpose.

I thought streamInstance.sendDirect() is kind of much better way of injecting metadata to streams, as streamInstance.send() failed in case of transcoded streams in my early project. It seems i have to use streamInstance.send() to send metadata to all the clients,those are playing an vod stream.

Hope my whole day effort will be useful to some ppl looking for the same :slight_smile:

Krishna