Embedding a video or a stream
This page is for producers and editors who show a video or a live player hosted elsewhere on a page of the site. The
main tool is the External video block of the layouts editor, on installations with Exponential Layouts
(extension/explayouts). Pages without layouts have other options, listed at the end.
Contents
The External video block
The block is defined in extension/explayouts/settings/explayouts.ini.append.php ([BlockDefinition_video],
External video) and handled by expLayoutsVideoBlockHandler. Its settings:
| Setting | What to enter |
|---|---|
| Service | YouTube, Vimeo, Dailymotion, or Video address below |
| Video ID | the id of the video at that service |
| Caption | a caption shown under the player and used as its title |
| Video URL or embed src | for other services: the address of the player (the src of its embed code) |
| Width (px or %) | default 100% |
| Height (px) | default 360 |
| Autoplay | off by default; leave it off |
For the three services, the block builds the player address itself, and it uses their privacy-friendlier variants:
YouTube from www.youtube-nocookie.com/embed/, Vimeo with dnt=1, Dailymotion from www.dailymotion.com/embed/video/.
The id is checked: digits only for Vimeo, letters, digits, _ and - for the others.
For any other service, the address must be http or https and point to another host than your own site
(expLayoutsSafeValue::externalEmbedUrl()); anything else is dropped and the block shows "No video configured."
Add the block
- Open the page's layout in the layouts editor (The layouts editor).
- Add a block of type External video to a zone (Add a block).
- Choose the service and enter the id, or paste the player address.
- Enter a caption that says what the video is.
- Publish the layout (Publish, keep or throw away).
What visitors see
The player loads only after a click. Until then the page shows a Load video button and a note that loading
it sends data to the other host, and nothing is fetched from that host
(extension/explayouts/design/standard/templates/explayouts/block/parts/embed.tpl). On the click, a script puts the
<iframe> in place, sandboxed, with only your site's origin as referrer. This keeps third parties off the page until
the visitor chooses (Privacy and third-party players).
Other ways
| Way | When | Notes |
|---|---|---|
| HTML snippet block | a service's embed code that the video block cannot take | raw HTML, inserted as written: only for trusted editors, and it loads at once, not after a click |
| NG Video item (media site installations) | a video page of its own | Video type YouTube, Vimeo, Dailymotion or uploaded file; YouTube loads after a click (full_ng_video.tpl) |
| An uploaded file | you own the file and want no third party | Uploading video |
| Rich text | not for players | rich text cannot hold an <iframe>; see Media in rich text |
When the player does not appear
| Sign | Likely cause | Fix |
|---|---|---|
| "No video configured." | empty or refused address, wrong id | check the id; use the player address, not the page address |
| The button loads, the frame stays empty or shows a refusal | the site's Content Security Policy is enforced and does not allow the host | add the host with AdditionalSources[]=frame-src <host> (Working with your administrator) |
| The service says embedding is not allowed | the video's owner disabled embedding at the service | change it at the service |
| The frame works but is tiny | width or height | set Width 100% and a fitting Height |
As shipped, site.ini [ContentSecurityPolicy] Mode=auto sends no policy on public siteaccesses, and
Directives[frame-src]='self' applies only where the policy is on.
Related pages
- Live streams and premieres
- Layout types, zones and blocks
- Live stream guide
- Free documentation: this page is free to copy, translate and improve under the GNU FDL 1.3.
Become an Exponential Partner
Partners share their information, provide funding, contribute back and develop the products with us, and that is how Exponential grows. A partner website and dashboard are planned for mid-2027: please become a partner today to speed up our growth rate and land new features faster.