| Package | com.adobe.cc |
| Class | public class SimpleCCDecoder |
| Inheritance | SimpleCCDecoder CCDecoderImpl Object |
SimpleCCDecoder is a starting point for integrating closed captioning with an arbitrary streaming library. It can be adapted to work with NetStream, OSMF, or the streaming library of your choice.
While SimpleCCDecoder is the most flexible of all CCDecoder variants, it also requires the most work from you in order to make proper use of its functionality. If there already exists a different CCDecoder variant designed specifically for your streaming library, you are highly encouraged to select that variant over SimpleCCDecoder.
Using SimpleCCDecoderEnabling closed captioning in your application consists of the following steps:
In order to take advantage of SimpleCCDecoder, your assets must be packaged to encapsulate closed captioning data in the onCaptionInfo message. For more information on this area, please consult your packager or encoder vendor.
Initialize the decoderInitializing the SimpleCCDecoder typically consists of a few steps, as illustrated in the following code:
var parent:DisplayObjectContainer = ...; var ccDecoder:SimpleCCDecoder; // create a new instance ccDecoder = new SimpleCCDecoder(); parent.addChild(ccDecoder.displayObject); // enable the instance ccDecoder.enabled = true; // optionally select a type and service ccDecoder.type = CCType.CEA708; ccDecoder.service = CEA708Service.CC1;
You should have 1 instance of SimpleCCDecoder per video pane.
A key step in initialization is to properly add SimpleCCDecoder.displayObject to your display list. SimpleCCDecoder.displayObject is the pane on which contain the captions will be rendered. It is intended to be an overlay on top of your video object, and should be added to your display list in such a way that it will be in front of the video object. Typically the SimpleCCDecoder.displayObject and the video object will be the siblings within a common parent DisplayObjectContainer.
Update the video boundsIn order to properly size the caption overlay, you must notify the SimpleCCDecoder of the size of both the original video as well as the video as displayed on screen.
SimpleCCDecoder.videoBounds controls the bounds of the overlay. It must be set to the bounds of the video and updated any time the size of the video on screen will change.
Passing onCaptionInfo to the decoderA required step in properly using SimpleCCDecoder is to pass onCaptionInfo callbacks to the SimpleCCDecoder.
During packaging, your assets should have onCaptionInfo data messages embedded in stream. Whenever these callbacks arrive for your stream, you must call SimpleCCDecoder.onCaptionInfo to pass captioning information to the decoder.
SimpleCCDecoder.onCaptionInfo(o::void accepts a single object argument. The argument is expected to be an Object with a type and data attributes that follow the onCaptionInfo specification.
Resetting the decoder as neededTo ensure proper behavior, you must call SimpleCCDecoder.reset() whenever a number of situations occur:
SimpleCCDecoder.reset():void will reset the internal 608 decoder. It is analagous to a channel change in the television world.
Allow customization of other closed captioning attributesSimpleCCDecoder contains a number of properties that should be exposed via user interface controls. Most of these properties enable overriding font and color attributes and are required under FCC guidelines. You are responsible for adding UI controls to expose these properties, as well adding the necessary code to save and restore settings between sessions.
| Property | Defined By | ||
|---|---|---|---|
![]() | backgroundColor : int
Background color override to apply to rendered text. | CCDecoderImpl | |
![]() | backgroundOpacity : Number
Background opacity override to apply to rendered text. | CCDecoderImpl | |
![]() | defaultFont : String
The default font to use when no font override is specified. | CCDecoderImpl | |
| displayObject : DisplayObject [read-only]
The DisplayObject that will contain the rendered captions. | SimpleCCDecoder | ||
![]() | edgeColor : int
Edge color override to apply to rendered text. | CCDecoderImpl | |
![]() | edgeType : String
Edge type override to apply to rendered text. | CCDecoderImpl | |
![]() | enabled : Boolean
Whether caption data decoding and rendering is enabled or disabled. | CCDecoderImpl | |
![]() | enableRollUpAnimations : Boolean
Indicates whether rollup animations should be enabled (true), or not (false). | CCDecoderImpl | |
![]() | font : String
Font override to apply to rendered text. | CCDecoderImpl | |
![]() | fontSize : Number
Font size override to apply to rendered text. | CCDecoderImpl | |
![]() | safeAreaHeightPercent : Number
Override that can be used to resize the safe zone vertical margin. | CCDecoderImpl | |
![]() | service : String
The caption "service" to decode and render. | CCDecoderImpl | |
![]() | textColor : int
Text color override to apply to rendered text. | CCDecoderImpl | |
![]() | textOpacity : Number
Text opacity override to apply to rendered text. | CCDecoderImpl | |
![]() | type : String
The active type of closed captioning data to decode and render. | CCDecoderImpl | |
| videoBounds : Rectangle
The bounds of the overlay. | SimpleCCDecoder | ||
| Method | Defined By | ||
|---|---|---|---|
Constructs a new SimpleCCDecoder. | SimpleCCDecoder | ||
![]() | isServiceActive(service:String):Boolean
Checks if the provided service is active or not. | CCDecoderImpl | |
onCaptionInfo(o:*):void
Processes an onCaptionInfo message. | SimpleCCDecoder | ||
![]() | reset():void
Resets the internal decoder and renderer. | CCDecoderImpl | |
| displayObject | property |
displayObject:DisplayObject [read-only] The DisplayObject that will contain the rendered captions. It should be added to your display list so that it will may function as an overlay on top of your video object.
public function get displayObject():DisplayObject| videoBounds | property |
videoBounds:RectangleThe bounds of the overlay.
public function get videoBounds():Rectangle public function set videoBounds(value:Rectangle):void| SimpleCCDecoder | () | Constructor |
public function SimpleCCDecoder()Constructs a new SimpleCCDecoder.
| onCaptionInfo | () | method |
public function onCaptionInfo(o:*):voidProcesses an onCaptionInfo message.
Parameters
o:* — An Object with a type and data attributes that follow the onCaptionInfo specification.
|