Ticket #692 (closed feature: fixed)
Captions plugin rewrite
| Reported by: | jeroen | Owned by: | jeroen |
|---|---|---|---|
| Priority: | Milestone: | Plugins | |
| Component: | Keywords: | ||
| Cc: | pablo, zach | Forum thread: |
Description (last modified by jeroen) (diff)
First, there's a few small issues with the captions plugin:
- It blocks the controlbar in JW5 when in an over state. See solution here, using a margin flashvar.
- Captions are not appearing on a Mac, Flash 9, Chrome or Firefox it seems. This should be investigated.
Next to these small issues, there's a couple of new features we want to incorporate in the plugin.
V5 Port
The plugin should be rewritten for the v5 API (i.e. this captions 2.0 plugin is only 5.x compatible). That way, the plugin will continue working after we drop the V4 API support in 5.x.
As part of this port, the CC button (for dock and controlbar) should become skinneable.
Also as part of this port, support for inline captions (using Metadata from the player) can be dropped. It's fine to have only SRT / TT captions support.
Javascript callback
The plugin needs a javascript callback. This callback can be set with a flashvar (captions.callback) and is called every time a new caption should be displayed. This callback should also be called every time a captions should stop being displayed (send an empty string to the callback).
Multiple languages
Another highly requested feature is support for multiple languages (see e.g. www.whitehouse.gov).
This can be solved in terms of loading by allowing a comma-separated list for the captions.file flashvar. Alternatively, this list can be constructed of key:value pairs (until we come up with a more elegant solution):
player.addFlashvar("captions.file","english:cc/english.xml,spanish:cc/spanish.xml")
In terms of language selection, multiple languages can be accomodated by pushing a language select menu, either:
- Above the controlbar button, in case dock=false.
- Besides the dock button, in case dock=true.
If there's only one language, the menu is not needed and the controlbar/dock button will act as a toggle. If there's multiple languages, the menu is visible and the controlbar/dock button will then act only as a callout for the menu.
Rudimentary styling
Right now, the captions plugin doesn't support any styling of (sections of the) captions. This should become part of this plugin, using the following mechanisms:
- SRT files can use some rudimentary HTML support (<font>, <b>, <i>; the stuff supported by default in textfields).
- TT files can support the <styles> definitions of the W3C Timed Text format.
Since the W3C documentations is so useless, here's a practical example of how TT styling works.
Change History
comment:2 Changed 3 years ago by jeroen
- Description modified (diff)
- Summary changed from captions plugin: some fixes to Captions plugin rewrite
comment:3 Changed 3 years ago by jeroen
- Type changed from bug to feature
- Description modified (diff)
comment:4 Changed 3 years ago by jeroen
Small additional bug: if a user doesn't have flash cookies enabled then the jwplayer fails ungracefully.
var cke:SharedObject = SharedObject.getLocal('com.jeroenwijering','/'); cke.datacaptions.state? = stt;
comment:5 Changed 3 years ago by jeroen
Awesome work from Phil:
In general, just about all the issues are covered. The only exception is the Mac/Flash9 compatibility issue.
- v5 port - completed; new Captions.as implement IPlugin, and works natively with JW 5+
- the cc button isn't fully skinnable yet, due to some oddities in IDisplayComponent, though there is support for configured colors
- JS callback - added; accepts a JS function name via flashvar, function receives 1 parameter for the caption text
- languages - added parser support for language mapping (e.g., "en:file1,es:file2"); added floating dropdown selector which repositions for either dock or controlbar menu cases
- styling - enabled HTML textfields with direct transposition for SRT files (supporting inline html); also updated TTParser to handler TT stylesheets, as well as on-the-fly translation for inlined span tags.
Have to checkin everything and then write additional docs for it.
comment:6 Changed 3 years ago by jeroen
Also check if these v4 captions issues are still there or resolved:
- Carrier returns in TT files show up as double breaks in the display.
- In fullscreen, the captions are placed over the controlbar
- SRT files with additional breaks are parsed incorrectly.
- If there's no caption, the back area still shows.
- Last, the CC dock could use a slightly cooler graphic ;)
comment:8 Changed 3 years ago by jeroen
- Cc pablo, zach added
- Status changed from new to closed
- Resolution set to fixed
Checked in in [1293].
Note the following items were not included:
- Multiple languages. Let's first wait and see what happens around the HTML5 <track> element before inventing our own multi-lauguage setup.
- Javascript callback. This doesn't seem too useful, since the Flash captions are not hidden if JS callbacks are set up.
In addition to this, the following was added to the update:
- PNG skinning support, for a custom controlbar and dock button.
- A bottom-margin to the captions for when the controlbar is set over the display (so captions are not on top of the controls).
- Error handling for 404s, Crossdomains and XML parsing.
An annoying bug that's still open is the stealing of mouse focus by the Captions from the display. Somehow, the clip.mouseChildren=false and clip.mouseEnabled=false AS options do not work...
