Skip to main content
Use <fluid-media-widget> to display one media item or a playlist. You can listen for playback events and scope listeners to a specific embed. For widget modes that render CTA controls, you can also override the call to action without building a player from scratch.

Embed media

Use media-id for one item or playlist-id for a playlist:
If you provide both identifiers, playlist-id takes precedence. See FairShare web components for common widget attributes.

Listen for media events

The media API exposes six subscription methods: Subscribe through FairShareSDK.media:
Playback payloads include the media identifier and type, timestamp, playback position and duration, media URL, title, and the playlist identifier when applicable. Media types include video, image, pdf, and website. START fires once on the first play. A play after pausing emits RESUME. Completing the media resets the lifecycle, so replaying it emits START again.

Filter subscriptions

Pass a filter as the second argument to listen to one media item, one playlist, or a specific media item within a playlist:
Every subscription returns an unsubscribe function.

Listen on window

The same lifecycle is available as window events:
The event names are:
  • FLUID_MEDIA_LOAD
  • FLUID_MEDIA_START
  • FLUID_MEDIA_PAUSE
  • FLUID_MEDIA_RESUME
  • FLUID_MEDIA_COMPLETE
  • FLUID_MEDIA_CTA_CLICK
Prefer FairShareSDK.media subscriptions when possible because they support filters and return cleanup functions.

Configure media calls to action

CTA settings affect widgets that render CTA controls. Currently, default and popover widgets render them; inline and inline-shopping widgets do not. Set a default CTA for eligible media widgets on the page:
Override the default for one playlist or media item:
Set defaults, playlist overrides, and media overrides together when you already have the complete page configuration:
You can also set cta-options-manual-override directly on the embed:
Hide the CTA panel on one embed by setting enabled to false. type is still required; cart needs no other fields, so it keeps the override short:
This hides the whole panel, including the cart and lead-capture controls. The same enabled key works in setDefault, setForPlaylist, and setForMedia. To hide a media item’s CTA everywhere rather than on one embed, switch the CTA off on the media item in the admin instead. FairShare resolves CTA settings in this order:
  1. The embed’s cta-options-manual-override attribute
  2. Settings for the media item
  3. Settings for the playlist
  4. Page defaults
Settings created through the media API are page-scoped and stored in local browser storage. Read or clear the settings for the current page: