Giter Site home page Giter Site logo

cgiffard / captionator Goto Github PK

View Code? Open in Web Editor NEW
300.0 300.0 66.0 66.59 MB

HTML5 polyfill for closed captioning with the <track> element, and implements the WHATWG Timed Text Track specification.

Home Page: captionatorjs.com

JavaScript 99.45% Perl 0.55%

captionator's People

Contributors

cgiffard avatar silviapfeiffer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

captionator's Issues

Firefox 21 does not display the Captions

The Subtitles show for Chrome but when using Firefox 21 and this simple HTML below. do not show in Firefox

<!DOCTYPE html>
<html lang="en-GB">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
    <video controls width="640" height="480" >
        <source src="video.mp4" type="video/mp4">
        <source src="video.webm" type="video/webm">
        <source src="video.ogv" type="video/ogg">    
        <track src="video.vtt" kind="captions" srclang="en" label="English" />
    </video>
<script type="text/javascript" src="captionator.js"></script>
<script type="text/javascript" >
window.addEventListener("load", function(e) 
{
    captionator.captionify();
});
</script>    
</body>
</html>

Position: Absolute is ugly

I need to work out a better way to position cues on top of the video. Unfortunately, position absolute seems to be the most reliable solution for the time being, but it breaks in certain cases - such as presentations that slide around, or where the video itself moves.

Options are:

  • Keep using position: absolute and add more JS for determining when the video itself moves around
  • Stop using position: absolute in favour of a more robust positioning solution (as yet unknown.)

Ideas welcome!

DOMException 12: SYNTAX_ERR: You must use a valid kind when creating a TimedTextTrack

When using Firefox 21 this exception above is thrown for this simple HTML shown below. The Subtitles show for Chrome but do not show in Firefox

<!DOCTYPE html>
<html lang="en-GB">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
    <video controls width="640" height="480" >
         <source src="video.mp4" type="video/mp4">
        <source src="video.webm" type="video/webm">
        <source src="video.ogv" type="video/ogg">    
        <track src="video.vtt" kind="subtitle" srclang="en" label="English" />
    </video>
<script type="text/javascript" src="captionator.js"></script>
<script type="text/javascript" >
window.addEventListener("load", function(e) 
{
    captionator.captionify();
});
</script>    
</body>
```

Update renderer to support advanced WebVTT rendering options

These include class spans, voice spans, and timestamps, as well as cue settings, such as line position, direction, and size.

It'll require a rethinking of the renderer (especially as the renderer has to support other formats as well.)

As part of this update, the ::cue psuedoelement, and the :past and :future psuedoselectors should be supported.

Formally Document Captionator API

As in... in a big list.

Current documentation is written like a chunky walkthrough. Probably not a good reference for people just looking to flick through.

Respect extra cue settings as described by WebVTT

Currently, Captionator reads in, but ignores, most of the cue settings. These are stored against the cue, and parsed according to the specification.

This would require the rethinking of the current parser.

Subtitle text cut off

I'm using Captionator with a copy of the Blender project's Sintel. I've tried variations of SRT and VTT, but Captionator cuts off part of the text with longer text strings. Is this a measure of video control size?

(In addition, is there a way to modify the CSS?)

Language selection missing from demo in Chrome & Firefox

While playing the demo video on a Mac (MacOS X 10.11.1), I noticed the language menu does not
appear in Google Chrome, Firefox or Opera. The language menu does appear in Safari. All browsers were latest versions available at the time I looked at this.

I have attached a screen capture that illustrates this. If it is possible to show the language menu, in the other browsers, then it is not immediately clear.

browsers compared

Check license

I would like to send a pull request to add this library to cdnjs project. I want to check license of this library. It seems like you use BSD 2-Clause license. Is that right?
Thank you.

cdnjs/cdnjs#6176

Support SSA/ASS

Probably by far the most complex subtitle format (and one of the least standardized/documented), but also the most powerful.

Not enough Arguments Error

In my implementation as well as the demo I get "Not enough arguments" errors and for the demo a syntax error in the .srt file.

Error: uncaught exception: [Exception... "Not enough arguments" nsresult: "0x80570001 (NS_ERROR_XPC_NOT_ENOUGH_ARGS)" location: "JS frame :: file:///index.html :: <TOP_LEVEL> :: line 19" data: no]

Error: uncaught exception: [Exception... "Not enough arguments" nsresult: "0x80570001 (NS_ERROR_XPC_NOT_ENOUGH_ARGS)" location: "JS frame :: file:///captionator.js :: <TOP_LEVEL> :: line 804" data: no]

Error: syntax error
Source File: file:///video/arduino-en.srt
Line: 1, Column: 1
Source Code:
1

Write a Tutorial

Seems my documentation might be a bit crappy. A tutorial with screenshots would greatly assist.

Kind attribute omitted

Currently absence of kind attribute cause captionator to throw exception, but according to specs:
if there is no kind attribute, implementation need consider this as 'subtitles' kind.

From specs:
The attribute(kind) may be omitted. The missing value default is the subtitles state.

Captionator does not captionate in Firefox 36

I use Captionator's renderer (or the cuechange event if available) to receive notifications from a .vtt file and add the contents of the activecue to the DOM. Everything is working in Chrome (cuechange event) and in IE9(Captionator's renderer), but in Firefox I can't get any of them to work.

In Firefox 36 the following Captionator code returns true
typeof(document.createElement("video").addTextTrack) === "function"

But Firefox does not support the cuechange event either. So I am kind of stuck here.

Now I know that Firefox does not support the cuechange (https://bugzilla.mozilla.org/show_bug.cgi?id=1033144) and that this is not the place to address this issue. But Captionator seems to think that Firefox doesn't need Captionator at all, which imo is not the case.

(I have not tested this in other Firefox versions)

Basic styling question

I'm wondering what sort of (CSS) styling options Captionator allows for-- e.g. if I wanted the caption box to span 100% width of the video window, with a semi-transparent white background and padding around the text, would this be possible? Seems native track styling via CSS is rather limited, and I've been looking for a solution for a specific project... Thanks.

Implement animation options

Enable animation of cues (probably through CSS transitions.)

Not to be confused with roll up or karaoke style timed text supported by WebVTT - as this deals specifically with animation, not staged cue delivery.

Javascript Captionator: font size will not adjust

This issue originally appeared as a stackoverflow question (http://stackoverflow.com/q/28901277/170243) - reposting here as problem still exists...

My use case is that I want the captions playing EXTREMELY LARGE over a blank video.

So I've been trying to increase the size of the subtitles according to the documentation using the minimumFontSize directive and a few other attempts, but am finding the font stays stubbornly the same size.

I've boiled the demo video down to the essentials for this question and remain mystified. What am I doing wrong? My code is below and I've put it at (http://projectgrin.org/cap/) so you can see the live thing.

<!DOCTYPE html>
<html> <head> <meta charset="utf-8">
        <link rel="stylesheet" type="text/css" media="screen" href="css/captions.css"/>
    </head>
    <body>
        <video controls autobuffer id="videoTest" width="1010" height="364" >
            <source src="video/arduino.m4v" type="video/mp4" />
            <track kind="subtitles" src="video/arduino-en.vtt" type="text/vtt" srclang="en" label="English Subtitles" default />


        </video>
        <!-- Include Captionator -->
        <script type="text/javascript" src="js/captionator.js"></script>

        <!-- Example Usage -->
        <script type="text/javascript" src="js/captionator-example-api.js"></script>
        <script type="text/javascript">
            window.addEventListener("load",function() {
                    captionator.captionify(null,null,{
minimumFontSize:110, controlHeight:120
});

                var videoObject = document.getElementsByTagName("video")[0];
                videoObject.volume = 0;
                document.body.appendChild(generateMediaControls(videoObject));
            },false);
        </script>
    </body>
</html>

How to use Captionator when browser supports track element (natively but badly)?

Chrome supports <track> elements natively. But not completely, eg, things like L:5% don't work.

Using Captionator, my WebVTT positioning options work correctly in Firefox.

Is there some way to make Captionator work on Chrome too โ€“ ie, to prevent Chrome from natively displaying the captions, and let the polyfill do it instead?

Enable use of verbose <source> type markup in MediaTracks

This could be hard, as it runs up against a browser parser bug. Basically the following syntax should be supported:

<track kind="commentary" srclang="en" label="Director's Commentary">
    <source src="audio/commentary.ogg" type="audio/ogg" />
    <source src="audio/commentary.mp3" type="audio/mp3" />
    <source src="audio/commentary.wav" type="audio/wav" />
</track>

At the moment the elements appear outside of the track, meaning they can't be associated with it (negating the whole point of marking the document up like this!)

I do think this syntax should be supported. _It makes sense._

Synchronised media is nice, (and already supported, I might add!) but semantically it seems a little off. An assistive/media enhancement track shouldn't appear separately to a media element, since it is hierarchically a descendant of that element. Additionally, it clutters up the page, adding unintended meaning and distraction to users uninterested in assistance or additional media features. Synchronised media doesn't degrade nicely in browsers not capable of associating it with the syncMaster - but assistive and enhancement tracks are nicely hidden from those agents with the syntax above. (Then you can make them work with Captionator!)

This is a parsing problem which may require re-downloading the whole page (painful, and runs into edge cases, especially where the page might have been originally requested using POST, or as part of a one-time-only user action.)

If it's somehow possible to easily extract the raw text, or work out which orphaned <source> elements are associated with the parent <track>, then that's the method we want to attack.

Strict Mode error in IE10

Finding IE 10 is throwing the following error:

SCRIPT5045: Assignment to read-only properties is not allowed in strict mode
captionator.js, line 920 character 6

That particular error message is taken from your demo page.

All lines of captions not seen

Hi,
I'm testing captionator and got it running, except the sub tiltes are not managed until the third one (nothing happens in the DOM for the 1st and second captions....

here's one of the very basic srt file:
WEBVTT

1
00:00:0,500 --> 00:00:5,951
This is a simple example
for srt captions

2
00:00:7,166 --> 00:00:15,883
Simply use a srt-file and append:
<a href="file.srt" class="track" data-enabled="true">My srt file</a>

3
00:00:16,000 --> 00:00:18,962
... to your media element

4
00:00:21,999 --> 00:00:24,368
There are more options, we will explain soon.

5
00:00:24,999 --> 00:00:31,368
Try to be accessible and nice to your users :-)

Thank you

Seek to text

This maybe out of scope for the project, but it would be amazing to support links in the transcription text to the corresponding points in the video. See http://www.subply.com/en/Products/InterActiveTranscript.htm as an example. My use case is incorporating transcription text into site-wide search and resolving the search to the appropriate point in the video.

Just to clarify, it's not clear to me if the API supports this use case easily.

Fix BCP-47 language string parsing

Currently Captionator uses a fairly hacky method of parsing the string, and disregards a lot of the data that a moderately verbose BCP-47 language string can provide.

Caption cues don't render in custom element as expected

I'm using the appendCueCanvasTo option parameter in order to render the captions there. But it's just rendering to default upper-left position. My init JS:

var videoCaptions = document.getElementById('videoCaptions');
captionator.captionify(null,null,{
    "appendCueCanvasTo": "videoCaptions"
    }
);

Enable use of external renderer

Write a function that can replace Captionator's internal cue renderer. Pass it to Captionator. Captionator uses it instead! Yay!

Unable to disable captions in Firefox

captionator.captionify(video, "en", {});
video.textTracks[0].mode = 'hidden'

The tracks still appear. This works fine in Chrome (which has native WebVTT support).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.