Code Monkey home page Code Monkey logo

javascriptsubtitlesoctopus's Introduction

Build Status SubtitlesOctopus displays subtitles in .ass format and easily integrates with HTML5 videos. It supports all SSA/ASS features and fully compatible with libass.

ONLINE DEMO / other examples with demo

Features

  • Supports all SSA/ASS features
  • Supports any fonts
  • Works fast (because uses WebAssembly with fallback to asm.js if it's not available)
  • Uses Web Workers thus video and interface doesn't lag even on "heavy" subtitles (working in background)
  • Doesn't use DOM manipulations and render subtitles on single canvas
  • Fully compatible with libass
  • Easy to use - just connect it to video element

How to use?

var options = {
    video: document.getElementById('video'), // HTML5 video element
    subUrl: '/test/test.ass', // Link to subtitles
    fonts: ['/test/font-1.ttf', '/test/font-2.ttf'], // Links to fonts (not required, default font already included in build)
    workerUrl: '/libassjs-worker.js' // Link to file "libassjs-worker.js"
};
var instance = new SubtitlesOctopus(options);

After that SubtitlesOctopus automatically "connects" to your video and showing subtitles. You can use it with any HTML5 player.

You can also use it without any video, like that:

var options = {
    canvas: document.getElementById('canvas'), // canvas element
    subUrl: '/test/test.ass', // Link to subtitles
    fonts: ['/test/font-1.ttf', '/test/font-2.ttf'], // Links to fonts (not required, default font already included in build)
    workerUrl: '/libassjs-worker.js' // Link to file "libassjs-worker.js"
};
var instance = new SubtitlesOctopus(options);
// And then...
instance.setCurrentTime(15); // Render subtitles at 00:15 on your canvas

See other examples.

How to build?

  1. Install EMSDK (it will take awhile). We recommend using Linux because building on Windows isn't tested.
  2. Don't forget to activate emsdk environment:
source ./emsdk_env.sh
  1. Clone repo with submodules:
git clone --recursive -j8 [email protected]:Dador/JavascriptSubtitlesOctopus.git
  1. Run make:
cd JavascriptSubtitlesOctopus
make

Why "Octopus"?

How am I an Octopus? Ba da ba da ba!

javascriptsubtitlesoctopus's People

Contributors

dador avatar tfsthiagobr98 avatar nickfujita avatar

Watchers

 avatar

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.