npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

videojs-overlay

v4.0.0

Published

A plugin to display simple overlays during video playback.

Downloads

21,468

Maintainers

sachin-brightcovesachin-brightcovealexey.kremsaalexey.kremsamelinda.darvasimelinda.darvasijose.luis.sanchezjose.luis.sanchezpedro-cruzpedro-cruzgabor.kiacz.brightcovegabor.kiacz.brightcoveadambertalanbcadambertalanbcmiklospocsaji_bcmiklospocsaji_bcmaraizamaraizaskarukamannaskarukamannaaviel_resnickaviel_resnicknorma.gonzaleznorma.gonzalezjvaldez1jvaldez1fsalazarbcfsalazarbccognatusbgscognatusbgsmbalasubramaniammbalasubramaniamssahssahdgonzalez89dgonzalez89areis10areis10vmnavarrovmnavarroalfredo-reyesalfredo-reyesjterranovajterranovajfloresbcjfloresbcmlopez.bmlopez.bttabrilla-bcttabrilla-bcmsivallsmsivallssstevanussstevanusrwbarber2rwbarber2rwingerrwingerbcc-bfranklinbcc-bfranklinapenigalapatiapenigalapatilmaultsbylmaultsbysravan.pbrsravan.pbrijunaidfijunaidfmgoncalvesmgoncalvesmfregozomfregozoareveloarevelomadhu_gmadhu_ghugocjimhugocjimdaniel_camposdaniel_camposkevin.schickkevin.schickm.morrisonm.morrisonuomaruomarabarstowbcabarstowbcsbarathansbarathankpandiyarajankpandiyarajanimoronesimoroneswalterseymourbcwalterseymourbcddashkevichddashkevichalbertogomezalbertogomezgestrada-brgestrada-bramillerbrightcoveamillerbrightcovelvohralvohramcho-bcmcho-bcawaldronawaldrondawnpackodawnpackoldominguezldominguezbc-srimron-soutterbc-srimron-soutterrsilva_brightcoversilva_brightcovejoeyleshjoeyleshlmelchorx1lmelchorx1juan-sanchezjuan-sanchezeolveraeolveracloewer_bccloewer_bccarredondocarredondobrianhsubrianhsuniklagbrightcoveniklagbrightcovetsraveling_bctsraveling_bcbcbcliffordbcbcliffordbc-acgarciabc-acgarciaadavila1adavila1kreynoldskreynoldsbgs-devopsbgs-devopsalbinjohnsonalbinjohnsonrtezerartezerabcmneilbcmneilrandresfrandresfv.kozlov_bcv.kozlov_bcnagendra_mnagendra_mmichaelmccarthybcmichaelmccarthybcponeill-bcovponeill-bcovmdeltorobcovmdeltorobcovjmohneycovejmohneycoveinbc01inbc01aperezbrightcoveaperezbrightcoveireyes94ireyes94brightcove-adminbrightcove-admintedktedkabradley-brightcoveabradley-brightcovebc-alivebc-alivelasanchezclasanchezcmarguinbcmarguinbcbrightcove-userbrightcove-userkmasonkmasoncbarstowcbarstowhikehhikehmyerramallamyerramallapdiaspdiasjwhisenantjwhisenantebertaudebertauddsalnikovdsalnikovsharanya.muruganandamsharanya.muruganandamxgarcia_npmxgarcia_npmjguerrajguerrarjunerjunejonbwalshjonbwalshkhaiphamkhaiphamwswanbeckwswanbeckgastafurovgastafurovadalwaniadalwaniekelson-bcoveekelson-bcovesysengsysengmcarreiromcarreirohwoodburyhwoodburyjblakerjblakerbcmauleonbcmauleonpaco_oblea_bcpaco_oblea_bcjsepulvedajsepulvedabiswaranjanbiswaranjanbarroyobarroyobmartinezbmartinezbc-jcarlsonbc-jcarlsoneledezmaeledezmajcuetojcuetoerodrigueserodriguespsousapsousamarcogaraymarcogarayjavibrightjavibrightbcpsalasbcpsalasetobinetobinackbabeackbabeomartinezomartinezmgonzalez_bcmgonzalez_bcpdohertybcovpdohertybcovmuthukumar.bcmuthukumar.bcbzizmondbzizmondjmpmacedojmpmacedoscorreiascorreialescorciolescorciocavieiracavieiraarunjeyaprasadarunjeyaprasadbvilvanathanbvilvanathananand.gangadharananand.gangadharanrociosantosrociosantosagarciabcovagarciabcovattinderattinderlauralopezlauralopezskumar85skumar85hrodriguez2hrodriguez2jasilvaantoniojasilvaantoniopalvarezbcpalvarezbcericramosericramoscarlosabajocarlosabajoingrid.s.cruzingrid.s.cruzluis_fernando_lopez_ruizluis_fernando_lopez_ruizvishal64vishal64tresa.bajitresa.bajiluis.garcia.brightcoveluis.garcia.brightcoverodrigofdzrodrigofdzpgutierrezgilpgutierrezgilharish17harish17jjeyaprakashjjeyaprakashrrajendran1698rrajendran1698jlomelijlomelisjimenezsjimenezrwenger_brightcoverwenger_brightcoverujordanrujordanstuartmhstuartmhjherrerabcovjherrerabcovmshiwalmshiwalptamizhptamizhakamalakkannanakamalakkannanroman-bcroman-bctnwannatnwannabsahlas.npmbsahlas.npmdherrera1109dherrera1109hswaminathanhswaminathanechengbcechengbcsbarrettbcsbarrettbcmisteroneillmisteroneilldmlapdmlapgkatsevgkatsevbrandonocaseybrandonocasey

Readme

videojs-overlay

Build Status Greenkeeper badge Slack Status

NPM

A plugin to display simple overlays - similar to YouTube's "Annotations" feature in appearance - during video playback.

Note: This meaning of an "overlay" is distinct from that of a modal dialog, which can overlay the entire player. This is built into video.js as the ModalDialog component.

Maintenance Status: Stable

Getting Started

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

<script src="path/to/videojs-overlay.js"></script>
<script>
  videojs(document.querySelector('video')).overlay();
</script>

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

Documentation

API

player.overlay()

This is the main interface and the way to initialize this plugin. It takes an options object as input.

overlay.get()

Returns an array of all the overlays set up for the current video.

overlay.add(Object|Array)

Adds one or more overlays to the current list of overlays without replacing the current list of overlays. Returns a reference to the added overlays.

const overlay = player.overlay({
  content: 'Default overlay content',
  debug: true,
  overlays: [{
    content: 'The video is playing!',
    start: 'play',
    end: 'pause'
  }]
});
const addedOverlays = overlay.add({content: "this is a new one", start: "play", end: "pause"});

overlay.remove(Object)

Removes an individual overlay from the list of overlays. Calling this method with an invalid overlay object removes nothing from the list.

const overlay = player.overlay({
  content: 'Default overlay content',
  debug: true,
  overlays: [{
    content: 'The video is playing!',
    start: 'play',
    end: 'pause'
  }]
});
const overlayToRemove = overlay.get()[0];
overlay.remove(overlayToRemove);

overlay.reset(Object)

Once the plugin is initialized, the plugin options can be reset by passing this function an object of options. This will remove the previous configuration and overlays, and update the plugin with the new values. It takes an options object as input.

// First initialization
const overlay = player.overlay({
  debug: true,
  overlays: [{
    content: 'The video is playing!',
    start: 'play',
    end: 'pause'
  }]
});

// Update configuration with different overlays
const overlayToRemove = overlay.reset({
  debug: false,
  overlays: [{
    content: 'Some new overlay content!',
    start: 'play',
    end: 'pause'
  }]
});

Plugin Options

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

align

Type: String Default: "top-left"

This setting can be overridden by being set on individual overlay objects.

Where to display overlays, by default. Assuming the included stylesheet is used, the following values are supported: "top-left", "top", "top-right", "right", "bottom-right", "bottom", "bottom-left", "left".

showBackground

Type: Boolean Default: true

This setting can be overridden by being set on individual overlay objects.

Whether or not to include background styling & padding around the overlay.

attachToControlBar

Type: Boolean, String Default: false

This setting can be overridden by being set on individual overlay objects.

If set to true or a string value, bottom aligned overlays will adjust positioning when the control bar minimizes. This has no effect on overlays that are not aligned to bottom, bottom-left, or bottom-right. For use with the default control bar, it may not work for custom control bars.

The value of string must be the name of a ControlBar component.

Bottom aligned overlays will be inserted before the specified component. Otherwise, bottom aligned overlays are inserted before the first child component of the ControlBar. All other overlays are inserted before the ControlBar component.

class

Type: String Default: ""

This setting can be overridden by being set on individual overlay objects.

A custom HTML class to add to each overlay element.

content

Type: String, Element, DocumentFragment Default: "This overlay will show up while the video is playing"

This setting can be overridden by being set on individual overlay objects.

The default HTML that the overlay includes.

overlays

Type: Array Default: an array with a single example overlay

An array of overlay objects. An overlay object should consist of:

  • start (String or Number): When to show the overlay. If its value is a string, it is understood as the name of an event. If it is a number, the overlay will be shown when that moment in the playback timeline is passed.
  • end (String or Number): When to hide the overlay. The values of this property have the same semantics as start.

And it can optionally include align, class, and/or content to override top-level settings.

All properties are currently optional. That is, you may leave start or end off and the plugin will not complain, but you should always pass a start and an end. This will be required in a future release.

Examples

You can setup overlays to be displayed when particular events are emitted by the player, including your own custom events:

player.overlay({
  overlays: [{

    // This overlay will appear when a video is playing and disappear when
    // the player is paused.
    start: 'playing',
    end: 'pause'
  }, {

    // This overlay will appear when the "custom1" event is triggered and
    // disappear when the "custom2" event is triggered.
    start: 'custom1',
    end: 'custom2'
  }]
});

Multiple overlays can be displayed simultaneously. You probably want to specify an alignment for one or more of them so they don't overlap:

player.overlay({
  overlays: [{

    // This overlay appears at 3 seconds and disappears at 15 seconds.
    start: 3,
    end: 15
  }, {

    // This overlay appears at 7 seconds and disappears at 22 seconds.
    start: 7,
    end: 22,
    align: 'bottom'
  }]
});