Using Closed Captions without Custom Fields

Product
Video Cloud
Applies to Roles
Publisher, Developer
Version
Brightcove 5
Modules
Publishing Module
Edition
All

The standard way to deliver closed captions with the Accessible Video Player uses a custom metadata field that contains the URL of the captions file. Video Cloud's standard closed captioning plug-in requires this custom metadata field. Since custom metadata fields are available only for Video Cloud Pro and Enterprise publishers, this method of delivering closed captions won't work for Video Cloud Express publishers. This topic describes some other approaches you can take that are available to all Video Cloud publishers.

Main steps

The basis approach described in this article involves editing the source code for the standard closed caption plug-in so that instead of depending on a specific custom metadata field for the URL of the closed caption file, it gets the URL in some other way. In order to use this approach, you'll need to be familiar with writing and compiling ActionScript code.

Here are the main steps:

  1. Download the project file for the closed caption plug-in.
  2. Modify the closed caption plug-in's source code to change how the plug-in locates the closed caption file for the video.
  3. Compile the modified plug-in source and host the resulting SWF.
  4. In the Studio Publishing module, edit your player's plug-in settings to point to the URL of your closed caption plug-in SWF.

As with the standard closed caption plug-in, you must create and host a closed caption file for each video. The Video Cloud player supports only DFXP format caption files. Read more about creating caption files.

Modifying the closed caption plug-in

The standard closed caption plug-in includes these lines that determine where to find the closed caption file for the video. We look for a custom metadata field named dfxppath and load the closed captions file from the URL in that field.

var video:VideoDTO = mVideoPlayer.getCurrentVideo();
if (video && video.customFields.hasOwnProperty("dfxppath")) {
    mCaptionsModule.loadDFXP(video.customFields.dfxppath, video.id);

If you can't use custom metadata fields, you need to find some other way to get the closed caption file. Here are three possible approaches:

  1. Have a server side script that accepts a video ID and redirects to the closed caption file based on this ID. The server side script would change based on what programming language you want to use and how the file was looked up, but the ActionScript would be as simple as:
var video:VideoDTO = mVideoPlayer.getCurrentVideo();
if (video) {
    mCaptionsModule.loadDFXP("http://domain/script?id=" + video.id, video.id);
  1. Store all closed caption files in a known location using a standard naming convention based on the video ID. Then you could request the file directly in the following manner:
var video:VideoDTO = mVideoPlayer.getCurrentVideo();
if (video) {
    mCaptionsModule.loadDFXP("http://domain/path/captions" + video.id + ".dfxp", video.id);
  1. Put the path to the closed caption file in a configuration parameter in the player publishing code like this:
<param name=”dfxppath” value=”http://domain/path/file.dfxp” />

Then you can use the Player API to access the file path like this:

var video:VideoDTO = mVideoPlayer.getCurrentVideo();
var path:String = mExperienceModule.getPlayerParameter("dfxppath");
if (video && path) {
    mCaptionsModule.loadDFXP(path, video.id);

These are just three possibilities, but hopefully they demonstrate that with only a slight change to the plug-in, you can re-use it to work with however you store your closed caption files, whether you are a Video Cloud Express publisher or not, making the Accessible Video Player one that is available to allVideo Cloud customers.

Tags
captions, subtitles