🧱 Volto blocks#
sc-videos registers two Volto blocks. They serve different purposes and appear in different contexts.
🎬 Video Player block#
The Video Player block is designed for the Video content type page.
It reads the video URL directly from the parent content's videoUrl field (set via the 📋 IRemoteVideo behavior), not from block data.
Property |
Value |
|---|---|
Block ID |
|
Title |
Video Player |
Group |
|
Icon |
|
Restriction |
Only on |
Sidebar tab |
1 |
Schema#
Field |
Widget |
Default |
Description |
|---|---|---|---|
|
Boolean |
|
Start the video automatically on page load. |
|
|
|
Player width: |
|
|
|
Horizontal alignment: left, right, center, wide, full. |
Edit behavior#
When the parent Video content has no videoUrl yet:
The block renders an EditForm: an in-block placeholder that embeds the
VideoURLWidget.The editor pastes a URL and clicks the arrow button to fetch metadata.
After a successful metadata fetch (
_metadatais populated), the block transitions to the player view.
When videoUrl is already set (existing content):
The block renders the embedded video player.
The sidebar shows the schema fields (autoPlay, size, align).
Data flow#
The Video Player block does not store the video URL in block data.
It uses Volto's properties (parent content fields) and onChangeField to read and write the URL.
properties.videoUrl → VideoPlayerBlock View → VideoPlayer component
↑
EditForm → VideoURLWidget → onChangeField('videoUrl', url)
📺 Video block#
The Video block is for embedding an existing Video content item in any page. Documents, News Items, or any content type with Volto blocks support.
Property |
Value |
|---|---|
Block ID |
|
Title |
Video |
Group |
|
Icon |
|
Restriction |
Not on |
Sidebar tab |
1 |
Grid support |
Yes (registered in |
Schema#
Field |
Widget |
Default |
Description |
|---|---|---|---|
|
|
. |
Reference to a Video content item. Fetches |
|
Boolean |
|
Start the video automatically. |
|
|
|
Player width. |
|
|
. |
Horizontal alignment. |
|
Boolean |
|
When |
|
Text |
-- |
Caption title. Rendered as |
|
|
-- |
Plain-text caption description. Line breaks are preserved and rendered as |
The caption is rendered using the Caption component from @kitconcept/volto-light-theme as a <figcaption> inside the player's <figure>, and appears only when showCaption is true and either title or description has content.
Data adapter#
When an editor picks a video via the object browser or the in-block VideoInput, the block's dataAdapter shapes the catalog item into the href[] structure:
interface VideoHref {
'@id': string; // Content URL
Title: string; // Uppercase (catalog metadata)
title: string; // Lowercase (ObjectBrowserWidget display)
Description: string;
hasPreviewImage: boolean;
image_scales: ImageScalesSummary;
videoUrl: string; // External video URL
}
The title (lowercase) field is required by Volto's ObjectBrowserWidget to display the selected item label in the sidebar.
When a video is selected (via either the in-block picker or the sidebar object browser), the caption title and description are populated from the item's Title and Description, but only when those fields are currently empty, so editor overrides are never overwritten.
Edit behavior#
When no video is selected (data.href is empty):
The block renders a
VideoInputplaceholder with a browse button.Clicking the button opens the object browser, filtered to
Videocontent only.On selection, the
dataAdaptercommits the picked item todata.href[].
When a video is selected:
The block renders the embedded player with the video's preview image and title.
The sidebar shows the schema fields.
🎨 Styling schema enhancer#
Both blocks share a videoSchemaEnhancer that adds the alignment schema to the block's style fieldset.
The available alignment options are: left, right, center, wide, full.
The defaultStylingSchema from @kitconcept/volto-light-theme is also composed in, providing theme selection support.
See also
🔧 Volto widgets. The widgets used by these blocks (VideoURLWidget, VideoInput).
🧱 Blocks and widgets. When to use each block.
🎨 CSS custom properties. CSS custom properties for player theming.