This package includes a simple module, ModulePublishOnTextData, that injects onTextData events into a live stream. It's useful for testing a live closed caption implementation. This module takes caption data from a flat text file and injects an onTextData event into the stream every 6.5 seconds. Again, this module is only for testing purposes and is an example of how to inject onTextData events into a live stream.
Note: Wowza Media Server 3.1.1.08 or later is required.
An onTextData event is an AMF (Action Message Format) event that's traditionally associated with Real Time Messaging Protocol (RTMP) and Adobe® HTTP Dynamic Streaming (HDS). These events are used to carry closed caption or subtitle information. An onTextData event usually includes the following fields:
Using the Wowza Media Server® server-side API, it's possible to inject onTextData events into a live stream using the IMediaStream.sendDirect() API call (there are details below). This enables a publisher that passes closed caption data in the form of timed text events or SMPTE events to use the Wowza Media Server server-side API to inject onTextData into a live stream.
<Module> <Name>ModulePublishOnTextData</Name> <Description>ModulePublishOnTextData</Description> <Class>com.wowza.wms.plugin.closedcaption.test.ModulePublishOnTextData</Class> </Module>
<Property> <Name>publishOnTextDataFile</Name> <Value>${com.wowza.wms.context.VHostConfigHome}/content/ontextdata.txt</Value> </Property> <Property> <Name>publishOnTextDataPublishInterval</Name> <Value>6500</Value> <Type>Integer</Type> </Property> <Property> <Name>publishOnTextCharsetTest</Name> <Value>false</Value> <Type>Boolean</Type> </Property>
Where:
http://[wowza-ip-address]:1935/[application]/myStream/playlist.m3u8
Note: Captions will only display if closed captioning is turned on. To turn on closed captioning on an iOS device, go to Settings > Video and turn on the Closed Captioning option.
To add onTextData events to a live stream, use the sendDirect(handler, param...) method. The code to add an onTextData event to a stream looks like this:
AMFDataObj amfData = new AMFDataObj(); amfData.put("text", new AMFDataItem(onTextData.text)); amfData.put("language", new AMFDataItem("eng")); amfData.put("trackid", new AMFDataItem(99)); stream.sendDirect("onTextData", amfData);