Repository navigation
How to exclude remote script loading (CDN) from vidstack build? #1845
Replies: 1 comment
|
None of those four are loaded eagerly, so you mostly do not need to strip them from the build. Each one only loads when the player actually needs it, and HLS/DASH can be pointed at a local copy. When each URL is requested
They show up in your bundle because the source selector instantiates every provider loader up front (source-select.ts#L51-L56), so there is no import level switch to tree shake them out. But their code paths stay dormant unless a matching source or a cast click happens. Self host hls.js / dash.js Set import { isHLSProvider, isDASHProvider } from 'vidstack'
player.addEventListener('provider-change', (event) => {
const provider = event.detail
if (isHLSProvider(provider)) {
provider.library = myPluginUrl + '/vendor/hls.min.js'
// or with a bundler: provider.library = () => import('hls.js')
}
if (isDASHProvider(provider)) {
provider.library = myPluginUrl + '/vendor/dash.all.min.js'
}
})If you use a URL, ship the UMD builds: the loader injects a script tag and then expects Google Cast The SDK has to come from gstatic, so for CSP or GDPR the clean option is to remove the trigger. In the default layout the button is a .vds-google-cast-tooltip { display: none !important; }With the button gone nothing calls Vimeo / YouTube These are iframe embeds, so they inherently talk to the third party. If you do not want that, do not accept Vimeo/YouTube sources in the plugin; with only self hosted files the oEmbed call never happens. For CSP, that leaves |
Uh oh!
There was an error while loading. Please reload this page.
Hey vidstack team,
I'm building a self-hosted WordPress video player plugin and I'd like to avoid any remote script loading from the vidstack bundle for privacy/security reasons (CSP compliance, GDPR, self-hosted environments).
When inspecting the prod build, I found these remote URLs are loaded dynamically at runtime:
Questions:
Thanks!
All reactions