Embedding Youtube videos in Bludit
Photo by freestocks.org: https://www.pexels.com/photo/person-holding-space-gray-iphone-5-34407/
- Make sure your Content-Security-Policy header allows it. This should be enough to see the thumbnail and play the video:
In your CSP configuration:
frame-src youtube-nocookie.com www.youtube-nocookie.com youtube.com www.youtube.com;
img-src 'self' data: https://i.ytimg.com;
- youtube-nocookie.com is the domain if you choose the privacy option when generating shared links
- i.ytimg.com is needed for the preview thumbnails
- If you want CSS, etc. you may need to configure additional headers
- If you omit this step and you DO have a CSP in place, your browser will just show a "This content has been blocked by a policy"-message or similar. Open your browsers developer console to check for CSP related errors.
- In Bludit, go to:
Plugins -> TinyMCE -> Settings
- Add
media
to the "Toolbar top" and "Plugins" fields. Now the button for easier embedding of videos will show up.- Of course you can also copy&paste the iFrame-code from the Youtube-Share link and use the source code view (<> Button) to insert it manually.
- Profit!