<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
Usemedia-id for one item or playlist-id for a playlist:
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:
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:Listen on window
The same lifecycle is available as window events:FLUID_MEDIA_LOADFLUID_MEDIA_STARTFLUID_MEDIA_PAUSEFLUID_MEDIA_RESUMEFLUID_MEDIA_COMPLETEFLUID_MEDIA_CTA_CLICK
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:
cta-options-manual-override directly on the embed:
enabled to false. type is
still required; cart needs no other fields, so it keeps the override short:
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:
- The embed’s
cta-options-manual-overrideattribute - Settings for the media item
- Settings for the playlist
- Page defaults