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

videojsx-vast-plugin

v1.0.4

Published

HTML5 video player with VAST support

Downloads

225

Readme

videojsx-vast-plugin

Initially, the code was taken from videojs-vast-plugin and made it work with videojs 7. It is very different now.

This project intends to keep up to date with the videojs and its other dependencies.

Build

NodeJs and its package manager (npm) is required to build.

Run npm install then npm run-script build.

The build creates two independent artifacts in the dist/ folder:

| Artifact Name | Files | Description | | ------------- | -----------------------------------|-------| | Plugin | videojsx.vast.js, videojsx.vast.css| Standalone plugin that can be integrated to an external video.js player. | | Video Player | player.js | A file that has video.js, css and other dependencies bundled in. |

Also, every JavaScript .js file has a compressed version .js.gz

Usage

Setting Up Plugin Scripts

Include this plugin (videojsx.vast.css and videojsx.vast.js) and its dependencies.

Ordering does matter. Be sure you request video.js first and videojs-contrib-ads anywhere before videojsx.vast.js.

It will look something like this:

<head>
    <!-- video.js framework -->
    <link href="https://cdnjs.cloudflare.com/ajax/libs/video.js/7.2.3/video-js.min.css" rel="stylesheet">
    <script src="https://cdnjs.cloudflare.com/ajax/libs/video.js/7.2.3/video.min.js"></script>

    <!-- Ads plugin for video.js -->
    <link href="https://cdnjs.cloudflare.com/ajax/libs/videojs-contrib-ads/6.6.4/videojs.ads.css" rel="stylesheet">
    <script src="https://cdnjs.cloudflare.com/ajax/libs/videojs-contrib-ads/6.6.4/videojs.ads.min.js"></script>

    <!-- This plugin for video.js -->
    <link href="http://where-you-host-the-plugin.com/videojsx.vast.css" rel="stylesheet">
    <script src="http://where-you-host-the-plugin.com/videojsx.vast.js"></script>
</head>

Setting Up Video Player Script

Put anywhere before you start using it. For example, in the head section:

<head>
    <script src="http://where-you-host-the-plugin.com/player.js"></script>
</head>

General Use

Example:

<video id="vid1" width="640" height="400" controls class="video-js vjs-default-skin" data-setup='{"autoplay":false}' poster="your-poster.jpg">
  <source id ="mysrc" src="your-content.mp4" type="video/mp4">
  Your browser does not support video.
</video>
<div id="companion"></div>

<script>
  var player = videojs('vid1');

  var companion = {
    elementId: "companion",
    maxWidth: 300,
    maxHeight: 250
  };

  player.vast({url: 'http://your-vast-url.com/vast.xml', skip: 8, companion: companion});
</script>

Options

| Name | Optional | Default | Description | | ------------------ | -------- |---------| ----------- | | url | Yes | n/a | URL that responds with a VAST document| | xml | Yes | n/a | The VAST document. Use as an alternative to url. Can be a String or XMLDocument.| | seekEnabled | Yes | false | Enable the player seek control when advert is playing. controlsEnabled must be enabled also.|
| controlsEnabled | Yes | false | Enable the player controls (pause, play, volume) when advert is playing|
| wrapperLimit | Yes | 10 | Maximum number of VAST wrappers (aka VAST request redirects) allowed|
| withCredentials | Yes | true | Enable third-party cookies on the VAST request| | skip | Yes | 0 | Number of seconds the user has to wait before the advert can be skipped|
| companion | Yes | {} | See Companion options below | | vpaid | Yes | {} | See VPAID options below |

Companion Options

| Name | Optional | Default | Description | | ------------- | -------- |----------------------| ----------- | | elementId | No | n/a | Id of the HTML element that will serve as the creative container| | maxWidth | No | n/a | The maximum width allowed for the creative | | maxHeight | No | n/a | The maximum height allowed for the creative|

VPAID Options

| Name | Optional | Default | Description | | ---------------- | ---------|---------------------- | ----------- | | videoInstance | Yes |'none' | Determines which video element to pass to the VPAID ad. Any one of: 'none', 'new' and 'same'. | | containerId | Yes |undefined | The id of the container. Usage is not recommended. | | containerClass | Yes |'vjs-vpaid-container'| The class name of the container. Usage is not recommended.|

Dev Workflow

Run npm start brings up a development server at port 9999 with automatic background builds.

The page is http://localhost:9999/index.html

The command should automatically open this page.

The build will be triggered when any of the files under src/ is modified. The currently opened page on port 9999 should reload automatically.

Testing

Experimental

Credit