Fix a video on a site with strict security settings
This article tells you what to send your developer when your website's security settings block PlayerMagick, so your video plays everywhere again.
Before you start
Most sales pages do not have these settings and need nothing from this article. It is for websites that send a Content Security Policy (CSP): a list of approved sources that the browser is allowed to load code, pictures and video from. A CSP is usually set up by a developer, a security team, a hosting company or a security plugin.
Signs that a CSP is blocking PlayerMagick:
- Nothing appears where the video should be, or only the thumbnail appears and the video never starts.
- The thumbnail appears, but after a click the video stays black or keeps loading.
- Your statistics or email leads stay empty while the video plays fine.
- Your developer sees messages starting with "Refused to" in the browser's console that mention
playermagick.comor your video storage address.
Step 1: Find your video storage address
Your videos are in PlayerMagick storage (most accounts): the PlayerMagick storage card shows no address. Write to support@playermagick.com and ask for the video storage address to allow.
Your account uses its own storage bucket:
- Go to Settings → Storage.
- Copy the Public URL for playback, for example
https://media.example.com. You need only the start of the address, up to the first/after the domain.
If your thumbnails, logo and video are stored at different addresses, note each one.
Step 2: Send this to your developer
Copy the message below, replace https://media.example.com with your video storage address from Step 1, and send it to whoever manages your website.
Please allow PlayerMagick in our Content Security Policy. Add these sources to our existing directives (do not replace the policy):
script-src:https://cdn.playermagick.com. If our policy uses nonces, instead addnonce="…"to the PlayerMagick<script>tag and'strict-dynamic'toscript-src: the player loads two more scripts from the first one, and the nonce alone does not cover them.connect-src:https://cdn.playermagick.comandhttps://media.example.com. PlayerMagick's statistics and email gate submissions also go tohttps://cdn.playermagick.com, so nothing else is needed. List the host without a path after it.media-src:https://media.example.comandblob:(required for playback on desktop and Android;blob:only allows the page's own in-memory video)img-src:https://cdn.playermagick.comandhttps://media.example.comstyle-src: nothing extra. Safari before version 16.4 needs our script's nonce (or'unsafe-inline') instyle-srcto style the player controls.- Nothing is needed for
font-src,frame-src,worker-src,object-srcorform-action. Trusted Types (require-trusted-types-for 'script') are supported.If we use PlayerMagick's page reveal, its embed code has a small inline
<style>and an inline<script>that stop the hidden content from flashing. Allow them with their hashes,'sha256-bm5OR/6PFxbgQJ1R2H3xTzhhLcQM8qfAMVkCWaknFZ0='instyle-srcand'sha256-pOhe1V5lT4lV173zraHzhuGQ01vbl2WDb6tth8v4se8='inscript-src, or with'unsafe-inline', or leave those two lines out (the hidden content then shows for a moment before it is hidden).If we use a personal deadline, its embed code has one more small inline
<style id="pm-dl-hide">line that keeps the after-deadline parts of the page from flashing. Allow it instyle-srcwith the hash of the line we use (the Publish tab shows it too):
- the usual line:
'sha256-cPw2NauRmwatzFYFFZmk4kNMJGGsFoxWCIdONHyZnFM='- the line with Hide before-deadline parts until the deadline is known on:
'sha256-TnNpAB0uT8rpr1iYFgkdvmN9OayfQrZitG7kX/MTNbo='Without it, the after-deadline parts may show for a moment while the page loads. Nothing else changes: the countdown and the page rules need no extra entry.
Tip: deploy the additions with
Content-Security-Policy-Report-Onlyfirst and check for violations fromcdn.playermagick.comor our video storage address before enforcing.
Here is what a simple policy looks like with these additions, for your developer's reference:
Content-Security-Policy:
script-src 'self' https://cdn.playermagick.com;
connect-src 'self' https://cdn.playermagick.com https://media.example.com;
media-src 'self' https://media.example.com blob:;
img-src 'self' https://cdn.playermagick.com https://media.example.com;
Step 3: Test your page
- When your developer has made the change, open your sales page in a private window.
- Check that the thumbnail appears.
- Click play and check that the video starts with sound.
- If you use an email gate, enter a test email and check that it appears in Leads.
- Wait about 5 minutes and check that your test play appears in Analytics. See Why don't my plays show in Analytics?
- If you use page reveal, play past the reveal time and check that the hidden content appears.
What each missing entry breaks
| What you see | What is usually missing |
|---|---|
| Nothing appears at all | cdn.playermagick.com in script-src or connect-src |
| Thumbnail shows, clicking play shows a spinner and nothing plays | cdn.playermagick.com (or 'strict-dynamic') in script-src |
| Thumbnail shows, the video never starts | Your video storage address in connect-src |
| Black box instead of the thumbnail, but the video plays | Your video storage address in img-src |
| The PlayerMagick logo is missing from the player's bar | cdn.playermagick.com in img-src |
| Video stays black on computers and Android, works on iPhone | blob: in media-src |
| Video plays, but no statistics | cdn.playermagick.com in connect-src is limited to certain paths (list the host without a path), or an ad blocker is the cause |
| Video plays, but emails do not reach Leads (visitors are not blocked) | The same: cdn.playermagick.com in connect-src without a path, or an ad blocker |
| Page reveal content flashes for a moment before it is hidden | The two page reveal lines are blocked (see Step 2) |
| After-deadline parts flash for a moment while the page loads | The pm-dl-hide line is blocked: add its hash to style-src (see Step 2) |
Good to know
- Allowed websites are a different setting. The security settings in this article are your website deciding what it loads. Choose which websites can play your video is your PlayerMagick setting deciding where your video plays. Neither replaces the other.
- Do not hide revealed content with
style="display:none"to avoid the flash. Strict security settings often block it, and when they do not, nothing ever shows the content again. - Ad blockers can cause the same symptoms on one computer only. Test in a private window with extensions turned off first. See Why is my video not showing?
Troubleshooting
- My developer added everything and it still does not work. Ask them to check the browser console for messages starting with "Refused to". Each one names the directive and the address that is still missing.
- It works on my computer but not on my phone. Check
blob:inmedia-srcfirst; iPhone does not need it, but Android does. - Only the email gate or the statistics fail. Check that
connect-srclistshttps://cdn.playermagick.comwithout a path after it, then test in a private window without extensions. Visitors can keep watching, but their emails are lost until this is fixed.