Skip to main content
iVentureTeam

video_preview

The live video preview in Odoo's product media dialog is video_preview: a field widget that trusts a server-computed embed and simply frames it 16:9. All the intelligence, and all the platform support, lives server side.

Siddharth JambukiyaSiddharth JambukiyaOdoo Techno-Functional Consultant
August 26, 2026Updated August 26, 20265 min read
Technical namevideo_preview
Field typeshtml (core binds it to the computed embed_code field)
Viewsform
Modulewebsite_sale (eCommerce)
Used in core1 occurrence: the product.image form, the media dialog behind product images
VersionsOdoo 20.0, Odoo 19.0, Odoo 18.0, Odoo 17.0, Odoo 16.0
No-code setupNo. It ships in the product media dialog; Studio cannot place or configure it
Alternativesx2_many_media_viewer, image, image_url

What the video preview widget does

When you paste a video URL into a product image slot in Odoo eCommerce, a live preview appears beside it. That preview is video_preview, and it is one of the thinnest field widgets in core: a component with no logic whose template prints the field's HTML value inside a fixed 16:9 frame, and prints nothing when the value is empty.

The division of labor is the whole story. The widget sits on embed_code, a computed, unsanitized Html field on product.image; the server watches video_url, matches it against known platform patterns, and produces the iframe markup. The widget renders whatever arrives, which is also why it works: the value is trusted server output, never user-typed HTML.

What this means for your team

Product videos measurably lift conversion, and the friction in most shops is operational: marketers paste a link, publish, and only later discover the player never rendered. This preview closes that loop at data-entry time, the video plays in the dialog before anyone saves, and the paired warning text says immediately when a URL is not embeddable.

Knowing the platform list is the practical skill. A YouTube or Vimeo link previews instantly; a raw MP4 link or an unsupported host computes an empty embed and will never show, no matter how valid the URL looks. Teams that standardize on a supported platform for product videos skip the whole class of why is the video missing tickets.

Working examples

Core's usage, in the product media dialog

<field name="video_url"/>
...
<div invisible="video_url in ['', False]">
    <field name="embed_code" widget="video_preview"/>
    <h4 invisible="embed_code">Please enter a valid Video URL.</h4>
</div>

The three-part pattern: the editable URL, the preview on the computed embed, and a warning that shows precisely when the URL produced no embed.

The server side that feeds it

embed_code = fields.Html(compute='_compute_embed_code', sanitize=False)

@api.depends('video_url')
def _compute_embed_code(self):
    for image in self:
        image.embed_code = image.video_url and get_video_embed_code(image.video_url) or False

The platform regex table, and a thumbnail side effect

The platform support everyone asks about is defined in one place: the player_regexes table in Odoo's video embed helper, which in 19 lives in html_editor/tools.py. It matches YouTube in all its URL shapes including shorts and live links, Vimeo including private hash URLs, Dailymotion including short links, Instagram posts and Facebook videos and reels. Anything else, self-hosted files included, fails every regex, and the compute stores an empty value.

Two more source facts round out the picture. The onchange on video_url also tries to fetch a thumbnail and, when the image slot is empty, fills image_1920 with it, so pasting a YouTube link can populate the product image by itself. And the widget file has not changed since its Owl modernization: 16 through 18 differ only in style, and our diff of 19 against the development branch came back empty, byte-identical, making this one of the few widgets with literally nothing to re-verify for Odoo 20 so far.

Version compatibility

VersionStatusNotes
Odoo 20.0In developmentNot released. The development branch file is byte-identical to 19; see below.
Odoo 19.0VerifiedVerified against the shipped source; embed helper lives in html_editor.
Odoo 18.0VerifiedSame widget, minor code style differences only.
Odoo 17.0VerifiedSame widget, minor code style differences only.
Odoo 16.0VerifiedSame widget in the older class-property style.

Upgrade note. Nothing to do for the widget across any supported version. The embed helper moved modules over time, ending up in html_editor in 19, which only matters to custom code importing it.

What is changing in Odoo 20

Odoo 20 is expected at Odoo Experience in Brussels, 24 to 26 September 2026. We read the widget's file on the public development branch at the time of writing; the branch is unstable and this page will be re-verified after release.

Zero changes: the file is byte-identical to Odoo 19, component, template reference and registration alike. Platform support can still evolve independently through the server-side helper before release.

Common problems and fixes

SymptomCause and fix
Please enter a valid Video URL shows for a working linkThe URL matches none of the supported platform patterns, so embed_code computed empty. Use a YouTube, Vimeo, Dailymotion, Instagram or Facebook URL in a standard share format.
A self-hosted MP4 never previewsDirect video files are not in the platform regex table; only recognized platforms embed. Host the clip on a supported platform, or build a custom embed compute.
Preview is blank but the site shows the videoBrowser extensions or corporate policies can block third-party iframes in the backend. Test in a clean browser profile; the widget renders whatever iframe the server computed.
The product image changed after pasting a video linkThe video_url onchange fills an empty image slot with the video's thumbnail. Expected behavior; upload your own image to override it.
Reusing the widget on a custom field shows nothingThe widget only prints the field's HTML value; a char URL field has no embed markup. Compute embed HTML server side, ideally with Odoo's get_video_embed_code helper.

Video preview widget vs the alternatives

WidgetBest forKey difference
video_previewLive embed preview of a product video URL at data-entry timePure pass-through of server-computed iframe HTML in a 16:9 frame; never editable
x2_many_media_viewerManaging the whole media gallery, images and videos togetherAn x2many widget with a media dialog that creates the records this widget previews
imageThe product's still images in the same dialogBinary image field with upload, zoom and the WebP pipeline
image_urlDisplaying an image hosted at a URLRenders an img tag from a char URL, no embed computation involved

This widget answers will this URL embed, one video at a time. Managing the media gallery as a whole, images and videos together, is the media viewer widgets' job.

Frequently asked questions

Which video platforms does the preview support?+
Whatever the server-side embed helper recognizes. In Odoo 19 the regex table covers YouTube (including shorts and live links), Vimeo (including private hash links), Dailymotion, Instagram posts, and Facebook videos and reels.
Why does my valid URL say Please enter a valid Video URL?+
That warning is a separate element shown whenever embed_code is empty. The URL may be reachable, but if it matches no platform pattern the compute returns nothing, and the preview stays blank.
Can customers see this widget on the website?+
No. The widget is backend-only, in the product media dialog. The website renders the same embed_code through its own templates; the widget just previews it for the editor.
Can I use video_preview for videos on my own model?+
Yes, with the same recipe: a char URL field, an Html field computed through get_video_embed_code with sanitization off, and this widget on the computed field. The widget itself has nothing product-specific.
Why is the preview not editable?+
The component renders output only; there is no input path at all. Editing happens on video_url, and the preview follows the recompute automatically.
Does pasting a video really set the product image?+
It can. The onchange on video_url fetches the platform thumbnail and fills image_1920 when it is empty, a convenience worth knowing before wondering where the image came from.

Selling more with video on your Odoo store?

Product videos, rich media galleries and fast-loading pages pull in different directions unless someone tunes the whole stack. We build Odoo eCommerce catalogs where media helps conversion instead of hurting page speed.

Upgrade your product pages

How this page was produced

The widget and template were read from website_sale_video_field_preview.js and website_sale.xml on the Odoo 19.0 branch, the compute and platform regexes from product_image.py and html_editor/tools.py, versions 16 through 18 and the development branch were diffed, and the single core usage was verified in product_image_views.xml. Spotted an error? Tell us and we will correct the page.