data-swarm-setup is an attribute you add to one <smartvideo> tag to change how that player behaves. Everything else on the page keeps your global settings.
Reach for it when one video needs to differ — a testimonial that should loop silently, a training video where the number keys shouldn’t jump around, one video that needs its own promo banner or its own colors.
For a video in your SmartVideo Library you don’t have to write the attribute by hand. Open the video from Library in your dashboard, add the settings you want in its Overrides card, click Save, and copy its Embed code: the copied tag carries the attribute. Videos hosted elsewhere need the attribute written in, as below.
For settings that apply site-wide, use swarmoptions instead.
The format
The attribute takes a JSON object. That means double quotes around every property name and every string value, so wrap the attribute itself in single quotes:
<smartvideo src="https://your-video.example.com/file.mp4"
width="1280" height="720"
class="swarm-fluid" controls
data-swarm-setup='{"loop": true, "muted": true}'>
</smartvideo>
This is stricter than the swarmoptions object, which is ordinary JavaScript. In swarmoptions you can write { loop: true }; in data-swarm-setup it has to be {"loop": true}.
Get the JSON right before you publish. If the value isn’t a valid JSON object, SmartVideo ignores the whole attribute and loads the player with your normal settings. It writes a message to the browser console naming the value it rejected, except for a bare null, which is ignored silently. The video still plays and nothing else on the page is affected — but none of your per-video settings apply. Load the page once with the console open after editing the attribute.
Watch your quotes
The attribute is wrapped in single quotes and the JSON inside it uses double quotes. An apostrophe in your own text ends the attribute early and breaks the tag:
<!-- broken: the apostrophe in "don't" closes the attribute -->
data-swarm-setup='{"plugins": {"overlay": {"overlays": [{"content": "Don't miss out"}]}}}'
<!-- correct: write the apostrophe as ' -->
data-swarm-setup='{"plugins": {"overlay": {"overlays": [{"content": "Don't miss out"}]}}}'
The same applies to any HTML you put in banner content — use ' for apostrophes and keep attribute values inside that HTML in double quotes, which are safe here because JSON already escapes them as \".
What you can set per video
| Option | Type | What it does |
|---|---|---|
controls |
boolean | Show or hide the control bar. |
muted |
boolean | Start muted. |
loop |
boolean | Restart when the video ends. |
plugins |
object | Any plugin settings — keyboard, overlay, watermark, and ads. See the plugin tables in the swarmoptions reference. |
playbackRates |
array of numbers | The speeds the playback-rate button steps through, in the order you list them. |
skipSeconds |
number | How far both skip buttons jump. |
hideControls |
array of strings | Removes controls. Accepts skipForward, skipBackward, playbackRate, fullscreen, and pictureInPicture. |
doubleTapSeek |
boolean | Set to false to turn off the touch double-tap seek on the left and right of the picture for this video. |
theme |
object | This player’s colors, glass tint, corner radius, and play-button shape. Takes the same keys as theme in swarmoptions. See Give one video its own colors. |
Plugin settings are merged with your global ones rather than replacing them. If your page’s swarmoptions and this video’s data-swarm-setup both set the same plugin setting, either value can end up applied, so set each plugin setting in one place only.
playbackRates, skipSeconds, hideControls, and doubleTapSeek are the same settings as the player group in swarmoptions, but in data-swarm-setup they sit at the top level of the JSON rather than under player:
<smartvideo src="https://your-video.example.com/file.mp4"
width="1280" height="720"
class="swarm-fluid" controls
data-swarm-setup='{"hideControls": ["fullscreen", "pictureInPicture"], "playbackRates": [1, 1.5, 2], "skipSeconds": 15}'>
</smartvideo>
Each of the four overrides your site-wide value on its own: naming skipSeconds here leaves a site-wide playbackRates in place, and {"doubleTapSeek": true} brings the gesture back on one video when your site-wide setting turned it off. hideControls replaces the site-wide list rather than adding to it, so {"hideControls": []} brings back every control your site-wide setting hid.
What you can’t set per video
| Setting | Why | What to do instead |
|---|---|---|
autoreplace |
Which videos SmartVideo takes over is decided before any individual player exists. | Set it in swarmoptions. |
autoplay |
Playback is started from the tag’s own attribute. See below. | Add or remove the autoplay attribute. |
techOrder |
SmartVideo chooses the playback technology per browser and format. | — |
Anything else you put in the attribute is passed through to the underlying player untouched. That is not a supported surface — if it isn’t in the “What you can set per video” table, we can’t promise it does anything useful, and options that rebuild the player’s controls can break it outright.
Which setting wins
A setting can come from three places. Except for poster, autoplay, and a plugin setting set in both places, they apply in this order, each layer overriding the one above it:
- The tag’s HTML attributes —
controls,muted,loop,posteron the<smartvideo>tag itself. - Your global
swarmoptions— the page-wide baseline. - This video’s
data-swarm-setup— wins over both.
So a tag that carries controls but sets {"controls": false} in data-swarm-setup hides its controls: the attribute is the starting point, the attribute value in the JSON is the last word. data-swarm-setup only overrides the keys you actually name — everything else still comes from your global settings.
poster is an exception: the tag’s poster attribute wins over a site-wide default. autoplay is another exception, covered next. A plugin setting set in both places is the third: see What you can set per video.
Autoplay is another exception
Don’t use data-swarm-setup to switch autoplay on or off. Autoplay is driven by the autoplay attribute on the tag itself, and SmartVideo starts playback from that attribute directly — {"autoplay": false} will not stop a tag that carries it.
To control autoplay, add or remove the attribute:
<!-- autoplays -->
<smartvideo src="https://your-video.example.com/file.mp4"
width="1280" height="720"
class="swarm-fluid" controls autoplay muted playsinline>
</smartvideo>
<!-- does not autoplay -->
<smartvideo src="https://your-video.example.com/file.mp4"
width="1280" height="720"
class="swarm-fluid" controls>
</smartvideo>
The basic SmartVideo tag options article covers autoplay, muted, loop, and playsinline as tag attributes.
Example: turn off keyboard shortcuts for one video
Useful when a video sits inside an interactive page and the arrow keys should scroll rather than seek.
<smartvideo src="https://your-video.example.com/file.mp4"
width="1280" height="720"
class="swarm-fluid" controls
data-swarm-setup='{"plugins": {"keyboard": {"enabled": false}}}'>
</smartvideo>
This works when your site-wide swarmoptions doesn’t also set keyboard. If both set it, either value can end up applied.
Example: give one video its own colors
Useful for a landing-page hero or a partner’s video that should carry different branding from the rest of your site.
<smartvideo src="https://your-video.example.com/file.mp4"
width="1280" height="720"
class="swarm-fluid" controls
data-swarm-setup='{"theme": {"primaryColor": "#043a7a", "glassTint": 8, "button": "circle"}}'>
</smartvideo>
Each theme key you name replaces your site-wide value for this player only; keys you leave out keep your site-wide value. button counts as one key: naming it replaces the site-wide button shape and its corner radius together, so set borderRadius again inside it if you changed the radius site-wide.
Example: loop one video with no controls
<smartvideo src="https://your-video.example.com/file.mp4"
width="1280" height="720"
class="swarm-fluid" autoplay muted playsinline
data-swarm-setup='{"loop": true, "controls": false}'>
</smartvideo>
Autoplay and muting stay on the tag as attributes; looping and the hidden control bar come from data-swarm-setup. Browsers block autoplay with sound, so keep muted set whenever you autoplay.
Example: a promo banner on one video only
Available on the Growth and Pro plans.
<smartvideo src="https://your-video.example.com/file.mp4"
width="1280" height="720"
class="swarm-fluid" controls
data-swarm-setup='{"plugins": {"overlay": {"overlays": [{"content": "Save 20% today", "align": "bottom", "start": 3, "end": 15}]}}}'>
</smartvideo>
Example: watermark one video
Available on the Pro plan.
<smartvideo src="https://your-video.example.com/file.mp4"
width="1280" height="720"
class="swarm-fluid" controls
data-swarm-setup='{"plugins": {"watermark": {"file": "https://your-site.example.com/client-logo.png", "xpos": 100, "ypos": 100, "opacity": 50}}}'>
</smartvideo>
Use this when your site-wide swarmoptions sets no watermark. If both set one, this video can show a mix of the two.
When the attribute seems to be ignored
- Open the browser console. When the attribute is bad, SmartVideo says so and quotes your value back — either
data-swarm-setup is not valid JSON; ignoring itordata-swarm-setup must be a JSON object; ignoring it. A barenullis ignored silently. For other rejected values, the message identifies the problem faster than anything else on this list. - Paste the attribute value into a JSON validator. Any online JSON linter will do. Worth it when the console has told you the JSON is invalid but a long value makes the reason hard to spot by eye.
- Check the quoting. Single quotes around the attribute, double quotes inside it. A double-quoted attribute containing double-quoted JSON ends the attribute early, and an apostrophe in your text does the same — write it as
'. - Check the value is an object. It must start with
{and end with}. A JSON array like["loop"]or a bare string is valid JSON but not a valid setting, so the whole attribute is ignored. - Check it belongs here.
autoreplaceis global-only; move it to swarmoptions. - Check a plugin setting isn’t also site-wide. If your
swarmoptionssets the same plugin setting, such askeyboardorwatermark, either value can end up applied. Set it in one place only. - Still stuck? Send us the tag and we’ll tell you what’s wrong with it.