# videojsadx

> Adx ads integration for VideoJS

Latest version **4.3.0** (published 2026-11-13) · ISC license · 0 weekly downloads

## Install

```sh
npm install videojsadx
pnpm add videojsadx
yarn add videojsadx
bun add videojsadx
```

## Health

**Score 55/100 (C)** — status: active.

Positive: no vulnerabilities; recently updated; high maintenance score.

Warnings: low downloads; no types; no esm support.

## Facts

| | |
|---|---|
| Version | 4.3.0 |
| Published | 2026-11-13 |
| First published | 2024-02-07 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 5 |
| Unpacked size | 1018.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | SIA Setupad, Signe Kreicere |
| Maintainers | signe.kreicere, supreez |
| Keywords | videojs, videojs-plugin, adx |

## Links

- npm: https://www.npmjs.com/package/videojsadx
- Repository: https://github.com/signekreicere/videojsadx
- Homepage: https://github.com/signekreicere/videojsadx#readme
- Issues: https://github.com/signekreicere/videojsadx/issues
- npm.io page: https://npm.io/package/videojsadx

## Dependencies (5)

- [react](https://npm.io/package/react.md) ^19.2.6
- [video.js](https://npm.io/package/video.js.md) ^8.23.7
- [react-dom](https://npm.io/package/react-dom.md) ^19.2.6
- [videojs-ima](https://npm.io/package/videojs-ima.md) ^2.6.0
- [videojs-contrib-ads](https://npm.io/package/videojs-contrib-ads.md) ^7.5.2

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 4.3.0 (latest) — 2026-11-13
- 4.2.1 — 2026-11-12
- 4.2.0 — 2026-11-10
- 4.1.2 — 2026-07-02
- 4.1.1 — 2026-07-02
- 4.1.0 — 2026-06-16
- 4.0.4 — 2026-05-25
- 4.0.3 — 2026-05-14
- 4.0.2 — 2026-05-08
- 3.2.1 — 2024-08-15
- 3.2.0 — 2024-08-12
- 3.1.2 — 2024-08-07
- 3.1.1 — 2024-07-30
- 3.1.0 — 2024-07-04
- 3.0.6 — 2024-07-04
- … 35 more at https://npm.io/package/videojsadx/versions

## README

# Installation

- Install with npm
  `npm i videojsadx` OR
- Add hosted code link in <head>
  `https://cdn.jsdelivr.net/npm/videojsadx@[version_number]/dist/videojsadx.js`

Additionally have to add this script in "head"

```html
<script src="https://imasdk.googleapis.com/js/sdkloader/ima3.js"></script>
```

# Description

VideoJS AdX combines videojs, video-ima, cotrib-ads to simply display videos with AdX integration

# Usage

Call function with your parameters

```html
<div class="stpd-video-container" id="video-container-1">
  <script>
    window.stpdVideo = window.stpdVideo || { que: [] };
    window.stpdVideo.que.push(function () {
      return window.stpdVideo.setConfig(
        {
          videoSrc: 'https://example.com/uploads/my-video.mp4',
          thumbnailSrc: 'https://signe.stpd.io/wp-content/uploads/2023/06/1667-11.jpg',
          thumbnailTitle: 'Video title',
          initialAutoplay: true,
          muted: false,
          playlist: [
            {
              videoSrc: 'https://example.com/uploads/my-video-1.mp4',
              thumbnailSrc: 'https://example.com/uploads/my-video-thumbnail-1.jpg',
              thumbnailTitle: 'Video title 1',
            },
            {
              videoSrc: 'https://example.com/uploads/my-video-2.mp4',
              thumbnailSrc: 'https://example.com/uploads/my-video-thumbnail-2.jpg',
            },
            {
              videoSrc: 'https://example.com/uploads/my-video-3.mp4',
              thumbnailSrc: 'https://example.com/uploads/my-video-thumbnail-3.jpg',
            },
          ],
          playlistAutoTitles: true,
          playlistAutoplay: true,
          miniPlayer: [
            { showOnlyOnAds: false, width: '400px', position: 'br', spacing: ['50px', '50px'] },
          ],
          miniPlayerMobile: [
            { showOnlyOnAds: false, width: '60%', position: 'bl', spacing: ['100px', '50%'] },
          ],
          adUnit:
            'https://pubads.g.doubleclick.net/gampad/ads?sz=640x480&iu=/124319096/external/ad_rule_samples&ciu_szs=300x250&ad_rule=1&impl=s&gdfp_req=1&env=vp&output=xml_vmap1&unviewed_position_start=1&cust_params=sample_ar%3Dpremidpostpod%26deployment%3Dgmf-js&cmsid=496&vid=short_onecue&correlator=',
          viewabilityThreshold: 0.7,
          overlayAdElement:
            '<' +
            'div id="my-ad">\n' +
            '<' +
            'script type="text/javascript">\n' +
            'console.log("triggering some banner");\n' +
            '<' +
            '/script>\n' +
            '<' +
            '/div>',
          debug: true,
        },
        'video-container-1'
      );
    });
  </script>
</div>
```

Parameter description:

- `<div class="stpd-video-container" id="video-container-1">`
  - For multiple insertions change ID's for each element.
- `}, 'video-container-1');`
  - If ID changed, change here as well

- `videoSrc:`
  - Initial video on page load
- `thumbnailSrc:`
  - Initial video thumbnail
- `thumbnailTitle:`
  - Initial video title
- `initialAutoplay:`
  - Autoplay on page load
- `muted:`
  - Play with sound on page load (NB! If initial autoplay also is turned on, video won't autoplay until users first interaction with page (click) because of global enhancing user experience policy.)
- `playlist:`
  - Can be removed if no playlist required.
  - Initial video automatically included as the first playlist element
  - `videoSrc:`
    - Video source for playlist item
  - `thumbnailSrc:`
    - Thumbnail source for playlist item
    - If video source local, thumbnail will be autogenerated if not provided
  - `thumbnailTitle:`
    - Video title for playlist item
    - If any of playlist items has title, others will be auto populated
- `playlistAutoTitles:`
  - Automatically populate playlist items with titles even if none provided
- `playlistAutoplay:`
  - Playlist autoplay
- `miniPlayer:`
  - DESKTOP
  - Can be removed if no mini player required.
  - `showOnlyOnAds:`
    - Show mini player only when ad is playing or all the time.
  - `width:`
    - Mini player width (px / % / ect). Height will be adjusted to aspect ratio.
    - Never renders narrower than 256px (256x144 at 16:9), the Google Ad Manager minimum for programmatic video. Keep `spacing` small enough for a 256px player to fit the viewport.
  - `position:`
    - Values: { tl / tr / bl / br }
  - `spacing:`
    - Values: [ { t / b } px / % / ect , { l / r } px / % / ect ]
- `miniPlayerMobile:`
  - MOBILE
  - Can be removed if no mini player required.
  - `showOnlyOnAds:`
    - Show mini player only when ad is playing or all the time.
  - `width:`
    - Mini player width (px / % / ect). Height will be adjusted to aspect ratio.
    - Never renders narrower than 256px (256x144 at 16:9), the Google Ad Manager minimum for programmatic video. Keep `spacing` small enough for a 256px player to fit the viewport.
  - `position:`
    - Values: { tl / tr / bl / br }
  - `spacing:`
    - Values: [ { t / b } px / % / ect , { l / r } px / % / ect ]
- `stickyOnLoad:`
  - If `true`, the player starts docked (sticky) on page load without a scroll trigger, unless its inline slot is already in view.
  - It behaves like the mini player otherwise: it snaps back inline when the inline slot scrolls into view and docks again whenever the slot is out of view, even before playback starts. A manual pause or the close button returns it inline; docking re-enables when playback resumes.
  - Uses `miniPlayer` (desktop) / `miniPlayerMobile` (mobile) `width`, `position` and `spacing`; `showOnlyOnAds` is ignored. Without a config for the current device, or without `videoSrc`, the player falls back to a normal inline player.
  - Always autoplays muted (`vpmute=1`) and sends `plcmt=2`. With `muted: false`, sound is turned on after the user's first interaction with the page, and later ad requests are sent with `vpmute=0`.
  - While docked and playing, other in-view stpdVideo players and `<video>` elements are kept paused. If the user starts another player (or the sticky player is manually paused), the other players are released and the sticky player pauses and returns inline.
  - Default: `false`.
- `alwaysSticky:`
  - If `true`, the player is always sticky: docked from page load and never shown inline (no in-article slot is reserved).
  - Uses `miniPlayer` (desktop) / `miniPlayerMobile` (mobile) `width`, `position` and `spacing`; `showOnlyOnAds` is ignored. Without a config for the current device, or without `videoSrc`, the player falls back to inline.
  - Follows Google sticky player rules: ad tag is sent with `plcmt=2` (overrides any `plcmt` in `adUnit`) and playback always starts muted (`muted` is forced to `true`). The IMA SDK sets `vpmute` on each ad request from the actual mute state.
  - The close button hides the sticky player for the rest of the pageview.
  - While playing, any other in-view stpdVideo player and any other in-view `<video>` element on the page is kept paused (players inside iframes cannot be controlled). If the user starts another player, the sticky player is paused instead (as a manual pause); manually pausing the sticky player releases the other players.
  - Ads-only slots must not use this option; use GPT with `plcmt=4` (Standalone) instead.
  - Takes precedence over `stickyOnLoad` if both are set.
  - Default: `false`.
- `adUnit:`
  - AdX ad unit.
  - Must use `https://`. The IMA SDK loads ads inside an HTTPS frame, so `http://` ad tags are blocked as mixed content (AdError 1005).
  - `vpmute` is set by the IMA SDK from the actual mute state; a hardcoded value in the tag is overridden.
  - `vid_d` (video duration) is set on every ad request from the real duration of the current video, including playlist items. It is omitted if the duration is not known yet. A `vid_d` already present in the tag is kept as is.
- `viewabilityThreshold:`
  - Number from 0 to 1 that controls when the player is treated as viewable.
  - Used for ad request/resume and pause logic.
  - Default: `0.7`.
  - Values outside range are clamped (`<0` becomes `0`, `>1` becomes `1`).
- `adDisplayInitMinDelayMs:`
  - Minimum delay in milliseconds between `initializeAdDisplayContainer()` and `requestAds()`.
  - Helps avoid IMA timing warnings around ad container initialization.
  - Default: `300`.
- `enforceAdPlayEligibility:`
  - If `true`, ads are requested only when playback is currently eligible by browser policy.
  - Eligibility requires either muted playback or prior user activation.
  - Default: `true`.
- `waitForConsent:`
  - If `true`, automatic ad requests (autoplay, sticky) wait until the visitor has answered the consent banner of an IAB TCF v2 CMP (`__tcfapi` event status `tcloaded` or `useractioncomplete`), so ads never start behind the banner and are requested with the visitor's consent choice.
  - Ads are not held when there is no CMP on the page, when the CMP reports that GDPR does not apply (e.g. US traffic), or when the CMP does not respond within 3 seconds.
  - A click on the player itself always requests ads right away.
  - Default: `true`.
- `stickyAdHoldMs:`
  - Sticky players (`stickyOnLoad`, `alwaysSticky`) hold their first automatic ad request until the visitor interacts with the page (scroll, wheel, click/tap, key press) or until the page has been visible for this many milliseconds, whichever comes first. This keeps quick bounces from producing non-viewable impressions.
  - `0` disables the hold.
  - Default: `5000`.
- `overlayAdElement:`
  - Overlay Ad tag code (with divs and stuff). (!NB <body> code only. If this is not an independent code, all <head> calls need to be added manually)
- `watermark:`
  - Values { true / false / URL } (Setupad logo enabled by default)
- `debug:`
  - Can be removed if no debug required.
  - Includes ad pause/resume trace logs with reason tags (for example: `viewability`, `mini-player-close`, `manual-pause`, `sticky-priority`, `sticky-close`).

---
_Source: https://npm.io/package/videojsadx · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
