KONtx.cc interface is used to implement closed captioning for streaming video.
If your app streams video programming on TV, you must determine if closed captioning is required and comply with all applicable regulations. See the US Federal Communications Commission Rulings in the Federal Register.
The closed captioning interface is provided as an add-on module to the KONtx Framework and must be embedded within your app's implementation.
Your app must load the
KONtx.cc module and provide captions data in the
Time Text Markup Language (TTML) format developed by W3C.
Captions added to the Media Player
Implement closed captioning using the captions classes in the KONtx Media Player. Caption TTML data must be added to the
KONtx.media.Captions list and the
Module File Structure
The following diagram shows the file hierarchy of the module:
The closed captioning module for KONtx requires the following steps:
Contentsfolder, for example:
KONtx.config.ccModulePathto the location of your closed captioning module in your
init.jsfile, see the example below.
init.jsfile, for example:
See the following sections for more closed captioning classes:
See the following references for more details:
The closed captioning module requires the following implementation:
Device Hardware Renderer used when Available
Some device partners support hardware rendering of closed captions. The default implementation of the closed captioning module
KONtx.cc detects and
selects hardware rendering when it is available. The
KONtx.cc module acts as a bridge and simply passes the TTML document to the hardware for
parsing and rendering. If the device partner does not support hardware rendering, the Framework uses Yahoo's software-based
The Simulator always uses Yahoo's software-based renderer.
Software Renderer provides Limited Consumer Control over Caption Display
The consumer's ability to control the caption display using the
KONtx.cc module is limited to the ability to turn it on and off in the transport control overlay,
and to remember this setting in the consumer's profile between viewing sessions. If hardware rendering is available, a user
interface to select character font size,
style, color and opacity, and background color and opacity may be provided by the device partner as system settings.
Most Developers should use the Provided Default Parser
Be sure to test the default parser to verify that it handles the structure of your TTML. Each playlist entry in the media player must specify a TTML URL. This XML formatted TTML document may need to be processed to normalize its structure for Yahoo's software renderer.
When you instantiate a
KONtx.media.Captions list, it provides the following default parser function to transform the given TTML URL to JSON.
Default Parser defined on Instantiation
The instantiation above provides the same implementation as detailed below:
Default Parser Implementation
Developers should create a Custom Parser to support Non-Standard Captions
The default parser described above works on most closed captioning TTML documents. Be sure to test the default parser first before implementing a custom parser. A custom parser solution is required to support content providers that supply non-standard captions documents.
If captions do not display correctly using the default parser, the captions document may contain formatting that is not understood by the software renderer and you must process the XML document to make it conform to the supported schema. If your TTML document contains nesting, then each paragraph tag must be flattened into a single entry that contains only string text.
The custom parser example provided below processes TTML-formatted XML and builds a JSON structure using Open Data Tables (ODT) and the Yahoo Query Language (YQL). Using XMLDOM and Xpath to do this type of transformation is not recommended due to performance constraints.
For Testing Only
The following is an example using a test ODT store that performs a normalizing function. This ODT store must not be used in a production environment because rate limits are applied to each ODT store. To create your own solution you can copy the provided ODT store to your own data table for publishing.
To create a custom parser you must implement a
callback function that takes a JSON payload
as its parameter. This
callback function must be executed to invoke the renderer.
Custom Parser Example
The example ODT store provided can be viewed and tested with the following services: