videojs-playlist-ui
DefinitelyTyped icon, indicating that this package has TypeScript declarations provided by the separate @types/videojs-playlist-ui package

5.0.0 • Public • Published

videojs-playlist-ui

NPM

A playlist video picker for video.js and videojs-playlist

Maintenance Status: Stable

Getting Started

Include the plugin script in your page, and a placeholder list element with the class vjs-playlist to house the playlist menu:

<!-- Include the playlist menu styles somewhere in your page -->
<link href="videojs-playlist-ui.css" rel="stylesheet">

<!-- Your player will be created here: -->
<video-js data-setup='{}' controls></video-js>

<!-- The playlist menu will be built automatically in here -->
<div class="vjs-playlist"></div>

<!-- Include video.js, the videojs-playlist plugin and this plugin -->
<script src="video.js"></script>
<script src="videojs-playlist.js"></script>
<script src="videojs-playlist-ui.js"></script>

<script>
  // Initialize the player
  const player = videojs(document.querySelector('video-js'));

  // Initialize the plugin and render the playlist
  player.playlistUi();
</script>

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

Root Element

Before this plugin will work at all, it needs an element in the DOM to which to attach itself. There are three ways to find or provide this element.

NOTE: In v2.x of this plugin, the root element was expected to be a list element (i.e., <ol> or <ul>). As of v3.x, the plugin creates a list; so, this root element must be a non-list container element (e.g., <div>).

Using Automatic Discovery (default, example)

By default, the plugin will search for the first element in the DOM with the vjs-playlist class.

To defend against problems caused by multiple playlist players on a page, the plugin will only use an element with the vjs-playlist class if that element has not been used by another player's playlist.

Using a Custom Class (example)

A custom className option can be passed to override the class the plugin will search for to find the root element. The same defense against multiple playlist players is reused in this case.

player.playlistUi({
  className: 'hello-world'
});

Using a Custom Element (example)

A custom element can be passed using the el option to explicitly define a specific root element.

player.playlistUi({
  el: document.getElementById('hello-world')
});

Other Options

The options passed to the plugin are passed to the internal PlaylistMenu video.js Component; so, you may pass in any option that is accepted by a component.

In addition, the options object may contain the following specialized properties:

className

Type: string Default: "vjs-playlist"

As mentioned above, the name of the class to search for to populate the playlist menu.

playOnSelect

Type: boolean Default: false

The default behavior is that the play state is expected to stay the same between videos. If the player is playing when switching playlist items, continue playing. If paused, stay paused.

When this boolean is set to true, clicking on the playlist menu items will always play the video.

Playlists and Advertisements

The PlaylistMenu automatically adapts to ad integrations based on videojs-contrib-ads. When a linear ad is being played, the menu will darken and stop responding to click or touch events. If you'd prefer to allow your viewers to change videos during ad playback, you can override this behavior through CSS. You will also need to make sure that your ad integration is properly cancelled and cleaned up before switching -- consult the documentation for your ad library for details on how to do that.

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 5.0.0
    516
    • latest
  • 2.3.4
    0
    • legacy

Version History

Package Sidebar

Install

npm i videojs-playlist-ui

Weekly Downloads

1,794

Version

5.0.0

License

Apache-2.0

Unpacked Size

411 kB

Total Files

31

Last publish

Collaborators

  • vmnavarro
  • dkingston
  • alfredo-reyes
  • jterranova
  • pradeep.vernekar
  • jfloresbc
  • mlopez.b
  • vasu.p
  • ttabrilla-bc
  • msivalls
  • sstevanus
  • rwbarber2
  • kaustubh-thube-brightcove
  • rwinger
  • bcc-bfranklin
  • apenigalapati
  • lmaultsby
  • sravan.pbr
  • agrojas-bc
  • ijunaidf
  • mgoncalves
  • mfregozo
  • arevelo
  • madhu_g
  • hugocjim
  • daniel_campos
  • kevin.schick
  • m.morrison
  • uomar
  • abarstowbc
  • sbarathan
  • kpandiyarajan
  • rburnham
  • imorones
  • walterseymourbc
  • ddashkevich
  • albertogomez
  • gestrada-br
  • amillerbrightcove
  • lvohra
  • mcho-bc
  • awaldron
  • fsalazarbc
  • dawnpacko
  • ldominguez
  • bc-srimron-soutter
  • rsilva_brightcove
  • joeylesh
  • lmelchorx1
  • juan-sanchez
  • eolvera
  • cloewer_bc
  • carredondo
  • brianhsu
  • niklagbrightcove
  • tsraveling_bc
  • bcbclifford
  • bc-acgarcia
  • adavila1
  • vaishalijayaraman
  • kreynolds
  • bgs-devops
  • albinjohnson
  • rtezera
  • bcmneil
  • randresf
  • v.kozlov_bc
  • nagendra_m
  • michaelmccarthybc
  • georgesanchez.diazjr
  • poneill-bcov
  • mdeltorobcov
  • jmohneycove
  • inbc01
  • aperezbrightcove
  • ireyes94
  • brightcove-admin
  • tedk
  • abradley-brightcove
  • bc-alive
  • lasanchezc
  • marguinbc
  • brightcove-user
  • kmason
  • cbarstow
  • hikeh
  • myerramalla
  • pdias
  • jwhisenant
  • ebertaud
  • oespinosac
  • dsalnikov
  • sharanya.muruganandam
  • vikaskumar.gajula
  • xgarcia_npm
  • jguerra
  • rjune
  • jonbwalsh
  • khaipham
  • wswanbeck
  • gastafurov
  • adalwani
  • ekelson-bcove
  • syseng
  • mcarreiro
  • elbadawimustafa
  • hwoodbury
  • jblaker
  • bcmauleon
  • paco_oblea_bc
  • jsepulveda
  • biswaranjan
  • barroyo
  • bmartinez
  • bc-jcarlson
  • eledezma
  • jcueto
  • erodrigues
  • psousa
  • marcogaray
  • javibright
  • bcpsalas
  • etobin
  • ackbabe
  • cvillasenor
  • omartinez
  • mgonzalez_bc
  • pdohertybcov
  • muthukumar.bc
  • bzizmond
  • jmpmacedo
  • scorreia
  • lescorcio
  • cavieira
  • arunjeyaprasad
  • bvilvanathan
  • anand.gangadharan
  • rociosantos
  • agarciabcov
  • attinder
  • lauralopez
  • skumar85
  • hrodriguez2
  • jasilvaantonio
  • palvarezbc
  • ericramos
  • carlosabajo
  • ingrid.s.cruz
  • luis_fernando_lopez_ruiz
  • vishal64
  • tresa.baji
  • luis.garcia.brightcove
  • rodrigofdz
  • pgutierrezgil
  • harish17
  • jjeyaprakash
  • rrajendran1698
  • jlomeli
  • sjimenez
  • rwenger_brightcove
  • rujordan
  • stuartmh
  • jherrerabcov
  • mshiwal
  • ptamizh
  • akamalakkannan
  • roman-bc
  • tnwanna
  • bsahlas.npm
  • dherrera1109
  • hswaminathan
  • echengbc
  • sbarrettbc
  • misteroneill
  • dmlap
  • gkatsev
  • saxena-gaurav
  • brandonocasey