Sign videos you can embed on your own site

5 min read

Sign videos you can embed on your own site

A few years ago I added a small "Embed this video" link to signbsl.com. Paste the snippet it gives you into a school website, a blog, a VLE, and a sign video appears — playable, right there on the page.

It worked, but it looked like 2013. The card was a Twitter-style blockquote: a bold title, a definition, a video, and a line of grey credit text. It didn't look like signbsl.com, it had no player controls, and it didn't tell a reader anything about the sign they were looking at.

So over the last few days I rebuilt the whole thing — the loader that renders the card, the card itself, and the dialog that gives you the code. This post is what changed and why, plus a reference for the features if you already use the embed.

What it looks like now

Two sign language video cards side by side. The left is light on a light page; the right is dark on a dark page. Both show the sign for "goal", a poster frame, play controls, and badges for Football and GCSE vocabulary.

The card now follows the design of the main site: white surface, soft hairline border, 20px radius, Manrope and Plus Jakarta Sans, the same blue for links and the active state. It is still a single block-level element — no stylesheet, no iframe, no fonts of its own — so it survives being pasted anywhere.

Where the sign has them, it carries badges: the curated categories it belongs to (*Football*, *Food*, *School*) and any qualification vocabulary it appears in (GCSE, Signature Level 1, Signature Level 2). All of them link back to the relevant page on the site.

Under the video there are real controls — scrubber, play/pause, loop, and a Slow / Normal speed toggle. That last one matters for learners: the sign plays at half speed so you can watch the handshape, then back to normal to see it in context.

If a word has more than one video, the footer ends with an All N signs button that links through to the word page, where every video we hold for that sign is listed. The number is the real count of playable videos, not an estimate.

Getting the code

The "Embed this video" dialog on signbsl.com, showing the snippet to copy, a live preview of the card, and sections describing what visitors get and how the embed works.

Every sign page has an Embed this video link on each video. It opens a dialog with two lines of HTML:

<blockquote class="signbsldata-embed" data-vidref="2bxq0g4mos"><a href="https://www.signbsl.com/sign/cooking">Watch how to sign 'cooking' in British Sign Language</a></blockquote>
<script async src="https://embed.signbsl.com/widgets.js" charset="utf-8"></script>

Paste it into an HTML or Custom HTML block. That detail trips people up: in WordPress, a Paragraph block quietly strips the <script> tag, and then nothing renders but the plain link. The same goes for most editors that have a "rich text" mode.

Two things worth knowing:

  • One script tag per page. The blockquote marks where a card goes; the single widgets.js tag finds every one of them. Embed twenty videos, include the script once.
  • Nothing to maintain. The card is built from our database each time it is fetched, so corrected signs, new videos and extra badges appear on your site by themselves. You never need to re-copy the code.

Dark mode, properly

The card follows the reader's device setting. If someone has their laptop in dark mode, they get a dark card, not a glowing white rectangle on a dark page.

You can also pin it, which is useful if your site is light-only or you want a specific look:

<blockquote class="signbsldata-embed" data-vidref="2bxq0g4mos" data-sd-theme="dark"><a href="https://www.signbsl.com/sign/cooking">…</a></blockquote>

data-sd-theme="light" does the opposite. Leave it off and the card defers to prefers-color-scheme.

What changed under the hood

The parts a visitor doesn't see matter just as much.

It's lazy. Cards are fetched when they come within 400px of the viewport, not all at once on page load. A page listing thirty signs used to fire thirty requests at the server; now it fires them as you scroll, four at a time at most. Above-the-fold cards can opt out with data-eager.

It can't be broken by your theme, and it can't break your theme. The card is rendered inside a shadow root with its own reset, so a host page's * { box-sizing }, aggressive a { color }, or a global img { width: 100% } has no effect on it — and the card's styles can't leak out and restyle your links.

It validates what it gets back. The card HTML is sanitised before insertion: <script>, <object>, <embed>, on* attributes and javascript: URLs are stripped. There's an 8-second timeout per request, one retry on a transient failure, and cards that fail are left in place with a data-embed-error attribute plus a signbsl:embed-error event, so a host page can react to it.

It fails honestly. If a video has been removed, you get a "this video is no longer available" card that still links to the word page, rather than an empty hole or a broken player.

It doesn't block your page. The loader is about 3 KB gzipped, cached on Cloudflare's edge, and loaded with async. It never delays your own scripts or your first paint.

It's the same code for both sites. BSL and ASL used to be two hand-edited copies of the same file that had drifted apart. They are now generated from one template with a build script, deployed with a version stamp and a Cloudflare cache purge, and covered by a test suite (30 tests) that runs against the minified bundle.

No cookies, no trackers. The embed loads no advertising or analytics scripts, so there is nothing to add to a consent banner. Our servers do record which website asked for a card — from the referrer the browser sends — so I can see where the embed is in use and whether it's working. That's the whole of it, and it's written into the privacy policy too.

Two bugs this rebuild fixed

The count in "All N signs" was wrong on some cards. The number came from a SQL query that grouped by the video id, which meant it was counting the synset's *synonym rows* rather than its videos. A word with five videos could advertise "All 3 signs". It now counts playable videos from active sources, exactly as the word page does.

The button itself was also 10px too tall. It is an <a>, so height: 32px was applied to the content box and padding was added on top, while the buttons beside it — being <button> elements — were 32px including padding. One box-sizing: border-box and they line up.

Known limits

  • Light text is baked in for light mode. If you force dark mode on a page that is otherwise light, the card will look like a dark widget on a light page. That's deliberate: the card can't see your page's background, only the reader's preference.
  • The theme is resolved when the card mounts. If you switch your OS theme while a page is open, the card needs a reload to follow.
  • No captions yet. The sign videos don't carry them, and I'd rather add something real than invent subtitles.

Try it

Find a word on signbsl.com, press Embed this video, and paste the snippet somewhere. If you're using it somewhere unusual — a museum kiosk, an intranet, a VLE that mangles the markup — tell me how it goes. Reports of the "your editor stripped my <script> tag" kind are especially useful, because that's the failure people hit first.