Research
Security News
Threat Actor Exposes Playbook for Exploiting npm to Build Blockchain-Powered Botnets
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
videojs-playlist-ui
Advanced tools
A playlist video picker for video.js and videojs-playlist
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.vertical.css" rel="stylesheet">
<!-- 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 plugin and build the playlist!
videojs(document.querySelector('video')).playlistUi();
</script>
There's also a working example of the plugin you can check out if you're having trouble.
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>
).
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.
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'
});
A custom element can be passed using the el
option to explicitly define a specific root element.
player.playlistUi({
el: document.getElementById('hello-world')
});
NOTE: Previously, the plugin supported passing the element in lieu of passing options. That feature is deprecated and will be removed in 4.0. Please use the
el
option going forward.
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.
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.
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.
FAQs
A user interface for the videojs-playlist API
The npm package videojs-playlist-ui receives a total of 2,051 weekly downloads. As such, videojs-playlist-ui popularity was classified as popular.
We found that videojs-playlist-ui demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 178 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
Security News
NVD’s backlog surpasses 20,000 CVEs as analysis slows and NIST announces new system updates to address ongoing delays.
Security News
Research
A malicious npm package disguised as a WhatsApp client is exploiting authentication flows with a remote kill switch to exfiltrate data and destroy files.