GuideEnvironment
Content Security Policy
Allow the media, images, workers, and styles a Video.js player needs when your page enforces a Content Security Policy
Content Security Policy (CSP) limits which resources a page can load. Video.js uses the URLs you configure for media, posters, thumbnails, and captions. Some HLS renderers also create blob URLs or web workers, so your policy must allow those resources too.
Allow player resources
media-srcmust allow your media URLs.img-srcmust allow any poster or thumbnail image URLs.connect-srcmust allow manifests, playlists, captions, and segment requests when using HLS or DASH playback.media-src blob:is required when your engine uses Media Source Extensions (MSE), including HLS and DASH engines.worker-src blob:is required for hls.js workers, which are enabled by default.style-src 'unsafe-inline'is required for some player UI and HTML player styling behavior.
Recommended policy
Start with this policy for native, HLS, and DASH playback. For embeds and Google Cast, add the provider origins below.
This policy assumes you bundle Video.js with your application or serve it from your own origin. If you load the player from a CDN, add that CDN’s origin to script-src. Add it to style-src too if you load stylesheets from that CDN.
Replace broad sources such as https: with the exact origins your player uses. Remove sources your deployment does not need. Keep media-src blob: for engines that use MSE. Keep worker-src blob: for engines that create blob workers, as hls.js does by default.
Allow embeds and Google Cast
Add only the origins for the providers you use. Extend script-src with their script origins. If a provider lists iframe origins, replace frame-src 'none' with those origins. A dash means the Video.js integration does not directly load that resource.
For Cloudflare, use https://iframe.videodelivery.net unless your source URL names a customer origin. In that case, replace <code> with your customer code.
The Wistia SDK bundled with Video.js normally renders its player in the page and can fall back to an iframe. It loads scripts and media data from fast.wistia.com and fast.wistia.net. If you narrow connect-src, keep both origins.
The table covers entry scripts and embed frames. Provider SDKs can request additional resources. Test your selected media under your policy, check the browser’s CSP violations, and allow the exact origins those requests need.