# Inject Cuepoint

**URL:** https://community.wowza.com/t/inject-cuepoint/238
**Category:** Wowza Developer Dojo
**Tags:** wowza-streaming-server-java-api
**Created:** [November 17, 2009, 8:29pm UTC](https://community.wowza.com/t/inject-cuepoint/238 "2009-11-17T20:29:55Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![system](https://sea2.discourse-cdn.com/flex002/user_avatar/community.wowza.com/system/32/447_2.png) [@system](https://community.wowza.com/u/system)
#### Post date: [November 17, 2009, 8:29pm UTC](https://community.wowza.com/t/inject-cuepoint/238/1 "2009-11-17T20:29:55Z")

</div>

[https://www.wowza.com/docs/how-to-inject-cue-points-or-metadata](https://www.wowza.com/docs/how-to-inject-cue-points-or-metadata)

---

<div class="post-metadata">

### Author: ![Richard\_Lanham](https://avatars.discourse-cdn.com/v4/letter/r/c68b51/32.png) [@Richard\_Lanham](https://community.wowza.com/u/Richard_Lanham)
#### Post date: [May 15, 2010, 11:11am UTC](https://community.wowza.com/t/inject-cuepoint/238/2 "2010-05-15T11:11:30Z")

</div>

(Compact version)

Code to inject a cue point that gets recorded and triggered client side from the server side.

**_Note_** this requires Wowza Server 2.0.0.15 (patch 15) or higher

```auto
package com.wowza.example.module;

import com.wowza.wms.amf.*;
import com.wowza.wms.client.*;
import com.wowza.wms.module.*;
import com.wowza.wms.request.*;
import com.wowza.wms.stream.*;

public class ModuleInjectCuePoint extends ModuleBase {

	public void setCaption (IClient client, RequestFunction function, AMFDataList params)
	{
		String streamname = params.getString(PARAM1);
		String caption = params.getString(PARAM2);
		IMediaStream stream = client.getAppInstance().getStreams().getStream(streamname);
		
		//essential code
		AMFDataMixedArray data = new AMFDataMixedArray();
		data.put("caption", new AMFDataItem(capton);
		stream.sendDirect("setCaption", data);

		getLogger().info("Caption: " + caption);
	}
	
}

```

Flash Client 1, Live stream player with controls to inject the caption

```auto
// call the function:
netconnection.call("setCaption",null,"myStream","hello room");

// set up netstream for the callback on the live stream
nsPlayClientObj:Object = new Object();
nsPlayClientObj.setCaption = function(caption:String):void
{
trace(caption);
}
nsPlay.client = nsPlayClientObj;

```

Flash Client 2, a vod player

```auto
// set up netstream for callback on recorded stream
var nsPlayClientObj:Object = new Object();

nsPlayClientObj.setCaption = function(obj:Object):void
{
	trace(obj.caption)
}
nsPlay.client = nsPlayClientObj;

```

---

<div class="post-metadata">

### Author: ![Richard\_Lanham](https://avatars.discourse-cdn.com/v4/letter/r/c68b51/32.png) [@Richard\_Lanham](https://community.wowza.com/u/Richard_Lanham)
#### Post date: [May 31, 2010, 2:40pm UTC](https://community.wowza.com/t/inject-cuepoint/238/3 "2010-05-31T14:40:27Z")

</div>

You can use this method to do it. All the essentials are laid out above. Each translator would be using different cuepoint names, and each JW player would read one of those.

Richard

---

<div class="post-metadata">

### Author: ![Richard\_Lanham](https://avatars.discourse-cdn.com/v4/letter/r/c68b51/32.png) [@Richard\_Lanham](https://community.wowza.com/u/Richard_Lanham)
#### Post date: [May 31, 2010, 2:43pm UTC](https://community.wowza.com/t/inject-cuepoint/238/4 "2010-05-31T14:43:48Z")

</div>

The code in the top box, is server-side Wowza module for inserting cuepoints.

Each translator would be using a Flash application that uses the code in the middle box which sends commands to the server-side module.

The code in the lower box is the essential code to read a cuepoint in Flash player. You would have to add this to JW player.

Richard

---

<div class="post-metadata">

### Author: ![Richard\_Lanham](https://avatars.discourse-cdn.com/v4/letter/r/c68b51/32.png) [@Richard\_Lanham](https://community.wowza.com/u/Richard_Lanham)
#### Post date: [June 1, 2010, 10:44am UTC](https://community.wowza.com/t/inject-cuepoint/238/5 "2010-06-01T10:44:16Z")

</div>

This is new compact version of the code in the first post. The sendDirect method injects the cuepoint into the live stream and recording. The send method only handles the live stream.

Richard

---

<div class="post-metadata">

### Author: ![Richard\_Lanham](https://avatars.discourse-cdn.com/v4/letter/r/c68b51/32.png) [@Richard\_Lanham](https://community.wowza.com/u/Richard_Lanham)
#### Post date: [June 1, 2010, 1:58pm UTC](https://community.wowza.com/t/inject-cuepoint/238/6 "2010-06-01T13:58:30Z")

</div>

Download [patch 18](http://wowzamedai.com/devbuild.html) and it’s in the Server-side API document.

> void sendDirect(String handlerName)
> 
> Call client side NetStream method/handler and send event to underlying stream (will record
> 
> event)
> 
> void sendDirect(String handlerName, Object params)
> 
> Call client side NetStream method/handler and send event to underlying stream (will record
> 
> event)

Richard

---

<div class="post-metadata">

### Author: ![Richard\_Lanham](https://avatars.discourse-cdn.com/v4/letter/r/c68b51/32.png) [@Richard\_Lanham](https://community.wowza.com/u/Richard_Lanham)
#### Post date: [June 1, 2010, 2:01pm UTC](https://community.wowza.com/t/inject-cuepoint/238/7 "2010-06-01T14:01:01Z")

</div>

I added a note to the post:

**_Note_** this requires Wowza Server 2.0.0.15 (patch 15) or higher

---

<div class="post-metadata">

### Author: ![Richard\_Lanham](https://avatars.discourse-cdn.com/v4/letter/r/c68b51/32.png) [@Richard\_Lanham](https://community.wowza.com/u/Richard_Lanham)
#### Post date: [June 2, 2010, 6:12pm UTC](https://community.wowza.com/t/inject-cuepoint/238/8 "2010-06-02T18:12:51Z")

</div>

This is a Wowza Application Module. You need the Wowza IDE to compile this to a jar file in the Wowza lib folder, then you will be adding a Module reference to an Application.xml Modules list. The Wowza IDE is here:

[http://wowza.com/ide.html](http://wowza.com/ide.html)

Download the IDE and read the included guide to get started.

Richard

---

<div class="post-metadata">

### Author: ![Richard\_Lanham](https://avatars.discourse-cdn.com/v4/letter/r/c68b51/32.png) [@Richard\_Lanham](https://community.wowza.com/u/Richard_Lanham)
#### Post date: [July 3, 2010, 12:15pm UTC](https://community.wowza.com/t/inject-cuepoint/238/9 "2010-07-03T12:15:41Z")

</div>

Doesn’t seem like a good idea, it would not be faster. cuepoints is data stored with the stream. Video, audio, data. SharedObjects are stored on the server. There is also a way to store data in an external file that is called cuepoints, but that’s not the kind of cuepoint generally discussed around streaming media.

Richard

---

<div class="post-metadata">

### Author: ![Richard\_Lanham](https://avatars.discourse-cdn.com/v4/letter/r/c68b51/32.png) [@Richard\_Lanham](https://community.wowza.com/u/Richard_Lanham)
#### Post date: [September 26, 2010, 2:12pm UTC](https://community.wowza.com/t/inject-cuepoint/238/10 "2010-09-26T14:12:09Z")

</div>

I don’t think so, not that I know of, not with Wowza. That’s the advantage of the external method of cuepoints (xml file) used by many player systems: they are editable.

Richard

---

<div class="post-metadata">

### Author: ![Richard\_Lanham](https://avatars.discourse-cdn.com/v4/letter/r/c68b51/32.png) [@Richard\_Lanham](https://community.wowza.com/u/Richard_Lanham)
#### Post date: [September 26, 2010, 3:19pm UTC](https://community.wowza.com/t/inject-cuepoint/238/11 "2010-09-26T15:19:40Z")

</div>

JW Player and Flowplayer have a Captions Plugin:

[http://www.longtailvideo.com/addons/plugins/84/Captions?q=](http://www.longtailvideo.com/addons/plugins/84/Captions?q=)

[http://flowplayer.org/plugins/flash/captions.html](http://flowplayer.org/plugins/flash/captions.html)

Richard

---

<div class="post-metadata">

### Author: ![Richard\_Lanham](https://avatars.discourse-cdn.com/v4/letter/r/c68b51/32.png) [@Richard\_Lanham](https://community.wowza.com/u/Richard_Lanham)
#### Post date: [September 26, 2010, 3:29pm UTC](https://community.wowza.com/t/inject-cuepoint/238/12 "2010-09-26T15:29:24Z")

</div>

I thought your issue was editing cuepoints after, i.e., the recorded video.

Richard

---

<div class="post-metadata">

### Author: ![Richard\_Lanham](https://avatars.discourse-cdn.com/v4/letter/r/c68b51/32.png) [@Richard\_Lanham](https://community.wowza.com/u/Richard_Lanham)
#### Post date: [September 26, 2010, 4:04pm UTC](https://community.wowza.com/t/inject-cuepoint/238/13 "2010-09-26T16:04:15Z")

</div>

I don’t think there is, as I said. You can use an xml solution when you play the recording.

Captionate works with flv files only, under 500mb, and they do not mention editing, just injecting. I’ve never used it.

Richard

---

<div class="post-metadata">

### Author: ![Richard\_Lanham](https://avatars.discourse-cdn.com/v4/letter/r/c68b51/32.png) [@Richard\_Lanham](https://community.wowza.com/u/Richard_Lanham)
#### Post date: [September 27, 2010, 10:20pm UTC](https://community.wowza.com/t/inject-cuepoint/238/14 "2010-09-27T22:20:47Z")

</div>

```auto
nsClientObj:Object = new Object();
nsClientObj.setCaption = function(caption:String):void
{
trace(caption);
}
ns.client = nsClientObj;
ns = new NetStream(nc);
ns.addEventListener(NetStatusEvent.NET_STATUS, statusHandler);

```

Where “setCaption” is the cuepoint name.

Richard

---

<div class="post-metadata">

### Author: ![Richard\_Lanham](https://avatars.discourse-cdn.com/v4/letter/r/c68b51/32.png) [@Richard\_Lanham](https://community.wowza.com/u/Richard_Lanham)
#### Post date: [September 28, 2010, 11:47am UTC](https://community.wowza.com/t/inject-cuepoint/238/15 "2010-09-28T11:47:19Z")

</div>

This is ActionScript used in Flash CS authoring tool, or Flex/Flash Builder IDE.

Do you want our list of independent developers? If so, send email to support@wowza.com with link back to this thread.

Richard

---

<div class="post-metadata">

### Author: ![Antonio\_Gomez\_Murian](https://avatars.discourse-cdn.com/v4/letter/a/48db29/32.png) [@Antonio\_Gomez\_Murian](https://community.wowza.com/u/Antonio_Gomez_Murian)
#### Post date: [December 1, 2011, 5:19pm UTC](https://community.wowza.com/t/inject-cuepoint/238/16 "2011-12-01T17:19:40Z")

</div>

I’m using Wowza 3.0 and SendDirect() is not working with VoD streams.

I have to change to Send() for get it to work.

---

<div class="post-metadata">

### Author: ![Julio\_Costa](https://avatars.discourse-cdn.com/v4/letter/j/90ced4/32.png) [@Julio\_Costa](https://community.wowza.com/u/Julio_Costa)
#### Post date: [June 2, 2010, 10:05am UTC](https://community.wowza.com/t/inject-cuepoint/238/17 "2010-06-02T10:05:53Z")

</div>

How to use this example reference the code:

package com.wowza.example.module;

import com.wowza.wms.amf.\*;

import com.wowza.wms.client.\*;

import com.wowza.wms.module.\*;

import com.wowza.wms.request.\*;

import com.wowza.wms.stream.\*;

public class ModuleInjectCuePoint extends ModuleBase {

public void setCaption (IClient client, RequestFunction function, AMFDataList params)

{

…

Where put this code I need compile?

thanks for help

---

<div class="post-metadata">

### Author: ![dfs\_dfsasa](https://avatars.discourse-cdn.com/v4/letter/d/b77776/32.png) [@dfs\_dfsasa](https://community.wowza.com/u/dfs_dfsasa)
#### Post date: [May 31, 2010, 10:34am UTC](https://community.wowza.com/t/inject-cuepoint/238/18 "2010-05-31T10:34:04Z")

</div>

I dont quite understand!

With wirecast I’m sending over wowza a lifestream. Our translators sit in different countries and see the lifestream. They translate simultanously and want to inject their translations as subtitles into the livestream. Each language has a separate jw player.

How can my translators send their text to wowza?

Do I need to write a desktop application connecting to wowza(how to connect?) which uses cuepoints to inject the text into the livestream?

Another thing is also how to separate the different languages injected into a single livestream?

---

<div class="post-metadata">

### Author: ![dfs\_dfsasa](https://avatars.discourse-cdn.com/v4/letter/d/b77776/32.png) [@dfs\_dfsasa](https://community.wowza.com/u/dfs_dfsasa)
#### Post date: [June 1, 2010, 10:46am UTC](https://community.wowza.com/t/inject-cuepoint/238/19 "2010-06-01T10:46:17Z")

</div>

What is this bit of code doing?

byte[] dataData = amfList.serialize();

int size = dataData.length;

synchronized(stream)

{

long timecode = Math.max(stream.getAudioTC(), stream.getVideoTC());

stream.setDataTC(timecode);

stream.setDataSize(size);

stream.addDataData(dataData, 0, size);

}

I think

“stream.sendDirect(“setCaption”, data);”

should be

“stream.send(“setCaption”, data);”

---

<div class="post-metadata">

### Author: ![dfs\_dfsasa](https://avatars.discourse-cdn.com/v4/letter/d/b77776/32.png) [@dfs\_dfsasa](https://community.wowza.com/u/dfs_dfsasa)
#### Post date: [June 1, 2010, 4:45pm UTC](https://community.wowza.com/t/inject-cuepoint/238/20 "2010-06-01T16:45:18Z")

</div>

In the Wowza IDE and in the documents I cant find a sendDirect method. Can u provide me with a link?

[Next page](https://community.wowza.com/t/inject-cuepoint/238.md?page=2)
