Stimulus & content

Media

How to embed images, audio, and video as stimulus. Most media is authored as inline HTML inside `text:` and rides through the safe-HTML allow-list. A handful of question types — image-card layouts, image annotation, video annotation, text annotation — have first-class media properties.

There’s no generic image: / video: / audio: property

A common assumption — and a wrong one — is that every question type has a top-level image: (or video: / audio:) property for stimulus. It doesn’t. Standard question types don’t expose these as first-class properties. The path for media on a single, multi, gridSingle, info, etc. is inline HTML inside text: (or instruction:), passing through the Safe HTML sanitiser.

A handful of specialised types do expose typed media properties — see Per-type media properties below.

Inline HTML — the everyday route

Drop a standard HTML media tag into any text field. The sanitiser checks the URL protocol, attribute allow-list, and optional inline style="..." declarations.

<img>

- qid: QProductShot
    type: single
    text: |
        <img src="https://cdn.example.com/product-2026.jpg"
             alt="2026 model"
             width="480">
        Which version is in the photo?
    options:
        1: Standard
        2: Pro
        3: Enterprise

Allowed attributes on <img>: src, alt, width, height, loading, decoding, referrerpolicy. See Safe HTML → Allowed attributes.

<video>

- qid: QAdReaction
    type: open
    text: |
        <video src="https://cdn.example.com/ad-30s.mp4"
               controls
               width="640"
               poster="https://cdn.example.com/ad-poster.jpg">
        </video>
        What's your reaction to this ad?

Allowed attributes: src, controls, muted, loop, preload, controlslist, poster, width, height, playsinline. autoplay is rejected — the sanitiser strips it and fires a blocked-html-attribute diagnostic. Always provide controls so the respondent initiates playback.

<audio>

- qid: QSoundLogoRecall
    type: single
    text: |
        <audio src="https://cdn.example.com/jingle-3s.mp3" controls></audio>
        Which brand does this sound logo belong to?
    options:
        1: Brand A
        2: Brand B
        3: Brand C
        99: Don't recognise it

Same autoplay-blocked rule applies.

<source> for multiple formats

When you want graceful fallback across browsers, use multiple <source> children:

- qid: QClip
    type: info
    text: |
        <video controls width="640">
            <source src="https://cdn.example.com/clip.webm" type="video/webm">
            <source src="https://cdn.example.com/clip.mp4" type="video/mp4">
        </video>

<track> for captions

- video controls width="640">
    <source src="https://cdn.example.com/clip.mp4" type="video/mp4">
    <track src="https://cdn.example.com/clip.en.vtt"
           kind="captions"
           label="English"
           srclang="en"
           default>
</video>

Hosting and URLs

Allowed URL protocols (full list in Safe HTML → URL protocols):

UseAllowed
External CDNhttps://..., http://...
Linked-in audio datadata:audio/* (on <audio> and <source>)
Linked-in video datadata:video/* (on <video> and <source>)
Inline image datadata:image/* (on <img> and <source>)
Browser blobblob:

The platform doesn’t enforce a hosting model — point at any URL whose protocol passes the allow-list. In practice, that means uploading large media to a CDN you control and linking from there. data: URLs are useful for tiny inline assets (small SVGs, audio cues) but bloat the response payload for anything bigger.

<iframe> is stricter: only relative URLs and https:// URLs render. Embedding an external interactive widget through an iframe works, but only over HTTPS.

Per-option images

Some question styles (style: imageCards on single / multi, and cardSort) render an image alongside each option. These types accept an image: property on the option itself, not on the question.

- qid: QPickPackaging
    type: single
    style: imageCards
    text: Which packaging style do you prefer?
    options:
        1:
            label: Glass bottle
            image: https://cdn.example.com/pack-glass.jpg
        2:
            label: Aluminium can
            image: https://cdn.example.com/pack-can.jpg
        3:
            label: Cardboard carton
            image: https://cdn.example.com/pack-carton.jpg

The image: value is a URL string. The renderer runs the URL through the same protocol allow-list as inline <img src>. Without style: imageCards, the image: property has no effect — the option renders as a plain text label.

Per-type media properties

The four annotation-style question types and the conjoint families take typed media properties. These are first-class fields on the question, not inline HTML.

Question typePropertyValue
imageAnnotationimage:URL of the image to annotate
videoAnnotationvideo:URL of the video to annotate
textAnnotationpassage:Block-scalar text the respondent highlights

Each of these types interprets its media property as the stimulus the respondent operates on — not just decoration. A videoAnnotation doesn’t just play the video, it captures sentiment over time; an imageAnnotation doesn’t just display the image, it captures click locations. See the per-type pages for the full surface.

What’s not supported

  • No object form for inline media. <img> / <video> / <audio> take their attributes positionally in HTML — there’s no image: { src: ..., alt: ..., width: ... } shape on standard question types.
  • No multi-image gallery property. For multiple images on one question, lay them out with inline HTML (a <div> with flex styling) or split across pages.
  • No autoplay. Always-fire-on-render media is blocked — the respondent must initiate playback. This is enforced even when the attribute appears in literal markup.
  • No platform-managed media library. The KB doesn’t surface upload mechanics; check the platform’s media management UI for the upload path. From the YAML side, all you author is the URL.

See also

  • Safe HTML — allow-list of tags, attributes, and URL protocols
  • Inline CSS — style="..." declarations for sizing and layout
  • imageAnnotation — typed image: property for click-and-pin tasks
  • videoAnnotation — typed video: property for sentiment-over-time
  • textAnnotation — typed passage: property for highlighting
  • Custom HTML/JS — embed an interactive media widget without going through inline HTML