Files
vjs-player/bundle-files.js
oxmcandClaude Sonnet 5 7e995693b0 Upgrade to video.js 8, add real ads/EME, fix v8-incompatible plugins
- Bump video.js 7 -> 8.24.0 and all plugins to v8-compatible latest
  (contrib-ads, contrib-eme, errors, youtube, vjsdownload, playlist-ui,
  http-streaming, hls-quality-selector, hotkeys); drop unused/dead deps
  (videojs-flash, videojs-ads-markers, videojs-ssa's old dead entry).
- Add real ad support in src/module/ads/ad.js: Google IMA (videojs-ima)
  and a hand-rolled VAST-parsing 'ownAds' provider for a self-hosted ad
  server, replacing the old fake JSON-inventory exampleAds scaffold.
- Make videojs-contrib-eme genuinely optional: built as its own lazy-loaded
  chunk (bundle/vjs-player-bundle-eme.min.js), only fetched when a video
  actually requests DRM (data-eme="true").
- Add a singleInstance player mode: one reused Video.js player across many
  <video> elements (poster-thumbnail triggers swap src into it) vs the
  default one-player-per-element behavior.
- Rewrite src/module/share, src/module/overlay, src/module/ssa from their
  real ES6 sources (or manually de-transpiled dist, for ssa) because
  video.js 8's Component/Plugin are now native ES6 classes and the
  published dist builds invoke them via the old Babel `Class.call(this)`
  down-level pattern, which throws under v8. Verified all three in a real
  video.js 8 runtime via headless Chrome.
- Fix a watermark.js bug where a module-scoped DOM node was shared across
  every player on a page, so only the last-initialized one kept its mark.
- Split player.js out of the plugin bundle into its own file
  (bundle/vjs-player.min.js), loaded as a separate final script by
  player-init.js, fixing a double-declaration crash when a page loaded
  both the bundle and a separately-hosted player.js.
- Add bundle-files.js as the single source of truth for both bundlers;
  bundle-dev.js now produces an unminified build for local debugging.
  bundle-prod.js strips license comments from minified output and writes
  them to bundle/LICENSES.txt instead.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-29 02:49:35 -07:00

60 lines
2.6 KiB
JavaScript

// Shared file lists for bundle-prod.js and bundle-dev.js. Kept in one place
// so the dev and prod bundles can never drift apart on which files they ship.
// Specify the order JS and CSS files in arrays
const jsFiles = [
'node_modules/video.js/dist/video.min.js',
'node_modules/videojs-errors/dist/videojs-errors.min.js',
'node_modules/videojs-hotkeys/videojs.hotkeys.min.js',
'node_modules/videojs-contrib-ads/dist/videojs-contrib-ads.min.js',
'node_modules/videojs-ima/dist/videojs.ima.min.js',
'src/module/ssa/ssa.js',
'src/module/overlay/overlay.js',
'node_modules/videojs-hls-quality-selector/dist/videojs-hls-quality-selector.min.js',
'src/module/share/share.js',
'node_modules/videojs-watermark/dist/videojs-watermark.min.js',
'node_modules/videojs-vr/dist/videojs-vr.min.js',
'node_modules/videojs-youtube/dist/Youtube.min.js',
'src/module/ads/ad.js'
];
const cssFiles = [
'node_modules/video.js/dist/video-js.min.css',
'node_modules/videojs-errors/dist/videojs-errors.css',
'node_modules/videojs-contrib-ads/dist/videojs-contrib-ads.css',
'node_modules/videojs-ima/dist/videojs.ima.css',
'src/module/ssa/ssa.css',
'src/module/overlay/overlay.css',
'node_modules/videojs-hls-quality-selector/dist/videojs-hls-quality-selector.css',
'src/module/share/share.css',
'node_modules/videojs-watermark/dist/videojs-watermark.css',
'node_modules/videojs-vr/dist/videojs-vr.css'
];
// videojs-contrib-eme is deliberately NOT part of the main bundle above.
// DRM/EME is niche and adds weight every page pays for, so it ships as its
// own tiny chunk that player.js lazy-loads only when a video actually
// requests DRM playback (see initEme() / defaults.enableEme).
const emeJsFiles = [
'node_modules/videojs-contrib-eme/dist/videojs-contrib-eme.min.js'
];
// src/player.js ships as its own file, loaded after the plugin bundle above
// (see player-init.js) instead of being concatenated into it. That's the
// intended split: the bundle is video.js + all plugins (rarely changes),
// player.js is the per-site config/init logic (the thing you actually edit).
// Keeping them concatenated together was causing double-declaration crashes
// (e.g. "Identifier 'gup' has already been declared") whenever a page loaded
// both the bundle and its own separate player.js.
const playerJsFile = [
'src/player.js'
];
// Bundle file name base
const bundleFileName = 'vjs-player-bundle';
// Output name for the player.js chunk (see playerJsFile above)
const playerFileName = 'vjs-player';
module.exports = { jsFiles, cssFiles, emeJsFiles, playerJsFile, bundleFileName, playerFileName };