- 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>
29 lines
1.2 KiB
JavaScript
29 lines
1.2 KiB
JavaScript
const path = require('path');
|
|
const fs = require('fs');
|
|
const { jsFiles, cssFiles, emeJsFiles, playerJsFile, bundleFileName, playerFileName } = require('./bundle-files');
|
|
|
|
// Unminified concat for local testing/debugging: same file lists and order
|
|
// as bundle-prod.js (see bundle-files.js), just no terser/csso pass, so
|
|
// devtools stack traces and breakpoints land on readable source instead of
|
|
// mangled minified output. Kept in a separate bundle-dev/ directory so it
|
|
// never collides with (or gets confused for) the real production build.
|
|
const concatenate = (files, outputFile) => {
|
|
const combinedContent = files
|
|
.map((file) => `/* ---- ${file} ---- */\n${fs.readFileSync(path.join(__dirname, file), 'utf-8')}`)
|
|
.join('\n');
|
|
|
|
const outputPath = path.join(__dirname, 'bundle-dev', outputFile);
|
|
fs.writeFileSync(outputPath, combinedContent, 'utf-8');
|
|
console.log(`${outputFile} created: ${outputPath}`);
|
|
};
|
|
|
|
const bundleDevDir = path.join(__dirname, 'bundle-dev');
|
|
if (!fs.existsSync(bundleDevDir)) {
|
|
fs.mkdirSync(bundleDevDir);
|
|
}
|
|
|
|
concatenate(jsFiles, `${bundleFileName}.js`);
|
|
concatenate(cssFiles, `${bundleFileName}.css`);
|
|
concatenate(emeJsFiles, `${bundleFileName}-eme.js`);
|
|
concatenate(playerJsFile, `${playerFileName}.js`);
|