Code Monkey home page Code Monkey logo

videojs-transcript's Introduction

Video.js Transcript

Creates interactive transcripts from text tracks.

Alpha Release 3

Please report any issues or feature requests on the tracker. Thank you!

Getting Started

Once you've added the plugin script to your page, you can use it with any video:

<head>
<script src="video.js"></script>
<script src="videojs-transcript.js"></script>
</head>
<body>
<video id="video">
      <source src="whatever.webm" type="video/webm">
      <track kind="captions" src="mycaptions.srt" srclang="en" label="English" default>
</video>
<div id="transcript"></div>
<script>
    var video = videojs('video').ready(function(){
      // Set up any options.
      var options = {
        showTitle: false,
        showTrackSelector: false,
      };

      // Initialize the plugin.
      var transcript = this.transcript(options);

      // Then attach the widget to the page.
      var transcriptContainer = document.querySelector('#transcript');
      transcriptContainer.appendChild(transcript.el()); 
    }); 
</script>
</body>

There's also a working example of the plugin you can check out if you're having trouble.

You'll also want to include one of the css files. You can style the plugin as you like but there are a few examples in the /css folder to get you started.

Documentation

Plugin Options

You may pass in an options object to the plugin upon initialization. This object may contain any of the following properties:

autoscroll

Default: true

Set to false to disable autoscrolling.

scrollToCenter

Default: false

By default current row shows on the bottom on autoscrolling. Set to true to show it in the center

clickArea

Default: 'line'

Set which elements in the transcript are clickable. Options are 'timestamp', 'text', the whole 'line', or 'none'.

showTitle

Default: true

Show a title with the transcript widget.

(Currently the title only says 'Transcript')

showTrackSelector

Default: true

Show a track selector with the transcript widget.

followPlayerTrack

Default: true

When you change the caption track on the video, the transcript changes tracks as well.

stopScrollWhenInUse

Default: true

Don't autoscroll the transcript when the user is trying to scroll it.

(This probably still has a few glitches to work out on touch screens and stuff right now)

Plugin Methods

el()

Returns the DOM element containing the html transcript widget. You'll need to append this to your page.

Release History

0.8.0: Alpha Release 3
  • Updated for video.js 5.x
0.7.2: Alpha Release 2
  • Updated for video.js 4.12
0.7.1: Alpha Release 1
  • First release

videojs-transcript's People

Contributors

dorosh avatar walsh9 avatar xahgmah avatar z4y4ts 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

videojs-transcript's Issues

Fix syntax error in example code

Hey,

in your example code in the readme there's a syntax error in your JavaScript. You have a parenthese gone wrong.

var video = videojs('video').ready(function(){
      // Set up any options.
      var options = {
        showTitle: false,
        showTrackSelector: false,
      }); <---

There is no parenthese needed there, as it is just an object literal.

Multiple transcripts at a time

Hi, Thanks for making this awesome library.

I'm making a web page with videojs to let people learning English via watching videos.
So i want to show 2 different languages at a time while they watching videos

Something like this:

image

Do you have any suggestion about how to do this?
Thanks in advance

Doesn't work with Video.js 5.0

It looks like they changed something about the way tracks load, so I need to update the plugin.

Quick workaround for anyone trying to get this to work right now.

  1. Pass all the plugin initialization code as a function to videojs's ready callback. If you're working from the example, change the script on the example.html to something like this:
var video = videojs('video');
video.ready(function () {
  var transcript = video.transcript();
  var transcriptContainer = document.querySelector('#transcript');
  transcriptContainer.appendChild(transcript.el());
});
  1. You might also need to change the line of code in the plugin that says:
my.settings = videojs.util.mergeOptions(defaults, options);

To:

my.settings = videojs.mergeOptions(defaults, options);

How to destroy videojs-transcript?

I am using videojs-transcript with videojs-playlist and videojs-playlist-ui.

It's has been pretty fiddly getting it working, I think I am close, but as playlists (audio playlists for example) sometime don't require the transcript plugin, I think i need to remove the transcript plugin before switching playlists, else I get the error:

Uncaught TypeError: Cannot read property 'activeCues' of undefined

How can it be removed when it is not required?

Thank You.

Transcripts are not working for updated videojs version

videojs-transcript is not working with latest version of video-js. I have installed video-js 6.3.3 after that transcripts are not working as giving error as track is undefined. Can some one please explain what went wrong and how can i resolve this.

Video JS CDN:

<script src="https://cdnjs.cloudflare.com/ajax/libs/video.js/6.3.3/video.js"></script>

Integration with videojs -react

@walsh9 Do you have an idea regarding integrating this transcript with reactjs -videojs player, because in that as I call this.player.transcript gives and error no such function.
It would really help me for my project.

Add CI

This actually does have some tests. Let's make sure they pass.

How to use .srt file for captions and transcript?

I tried to add .srt file as captions for transcripts and it raising an error saying that "Malformed WebVtt Signature". Can someone tell me is it possible to use .srt files as transcript sources.

Thanks in advance.

How to update transcript content and functionality when navigating through playlist videos?

Hello,

I am currently working on a videojs playlist instance that works with videojs-transcript.

The transcript displays and functions fine on the first video, but when either manually clicking on another video in the playlist, or when advancing forward in a playlist from one video to the next, the transcript area and functionality stays the same (ie it is not "updated" to reflect the next video's caption file).

Is there a way to "update" the transcript content and functionality when navigating through playlist videos?

Thank You.

followPlayerTrack not working

videojs has no more captionstrackchange and subtitlestrackchange events

I managed to get around with:

          player.textTracks().on('change', _.debounce(function () {
            setTimeout(function () {
              player.trigger('subtitlestrackchange')
            }, 0)
          }, 1000, true))

scrollToCenter?

Has anyone been able to get scrollToCenter option working? I've not been successful with v0.8.1. Suggestions sincerely appreciated!

Plugin doesn't support multi videojs players

Hi,

On the occasion a page contains more than one audio/video player, the plugin wonโ€™t function as expected.

The plugin implements a single global player reference that is been overwritten by the latter player.
Please advise what should be the best approach for fixing this issue.

Tnx
Harel Gruia

Please tag current master as 0.8.1

Hi @walsh9,

I took the liberty to register your package on the Bower registry.
Would you please tag the latest commit as 0.8.1 or something above 0.8.0?

This would make the latest code installable via bower install videojs-transcript and also help us keep our bower.json cleaner.

Thanks!

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.