BloksMoleculeDevice Media

Device Media

Description

The Device Media component is a versatile molecule that allows you to showcase media content (images or videos) within various device frames. It supports different device types such as monitors, notebooks, phones, watches, tablets, and TVs. The component offers an optional glow effect and video looping functionality, making it ideal for creating engaging and visually appealing presentations of digital content across different device contexts.

Installation

bash
sabaccui add deviceMedia

Usage

Here are examples of how to use the Device Media component in different configurations:

Image on Monitor

Preview

monitor
Example image on a monitor

Image on Phone

Preview

phone
Demo image on a phone

Video on TV

Preview

tv

Schema

Field NameTypeDescriptionDefault Value
mediaassetThe media file (image or video) to be displayed. Required. Supports images and videos.-
glownumberIntensity of the glow effect behind the media. Range: 0-100.0
deviceoptionThe type of device frame to use. Options: monitor, notebook, phone, watch, tablet, TV.monitor
loopbooleanWhether to loop video content. Only applies to video media.false
scalenumberThe scale factor in percent for the whole element.100
  • Media

Notes

  1. The component uses a custom video decoder utility to generate a first frame preview for video content.
  2. Device frames are preloaded as webp images for optimal performance.
  3. The component implements lazy loading for video content using an Intersection Observer.
  4. Glow effect is created by applying a blur to a copy of the media behind the main content.

Best Practices:

  • Choose appropriate device frames that match the context of your content.
  • Use the glow effect sparingly to highlight important content without overwhelming the design.
  • Optimize your media files for web delivery to ensure fast loading times.
  • Consider using looping for short, engaging video clips that work well with repetition.
  • Ensure that the aspect ratio of your media content matches well with the chosen device frame for the best visual results.