Video

A component that provides responsive behavior to video-based media, with support for HTML video, canvas, iFrames and object embeds.

Install

npm install seed-video --save

Dependencies


Example

seed-video will automatically make videos responsive and resize to their parent container. Videos can be made responsive by wrapping them with a .c-video class.

<div class="c-video">
  <iframe width="560" height="315" src="https://www.youtube.com/embed/sn3fnvi9tew" frameborder="0" allowfullscreen></iframe>
</div>

By default, .c-video automatically adjusts <video> and <iframe> selectors. However you can apply the same responsive properties on any selector by using the .c-video__embed class.

<div class="c-video">
  <canvas class="c-video__embed">
    ...
  </canvas>
</div>

Sizes

The default ratio for .c-video is 16:9. However, this can be modified by applying any of the following modifier classes:

All of the following classes support responsive modifiers.

Class Ratio
.c-video--u-wide 21:9
.c-video--gr 16:10
.c-video--wide 16:9
.c-video--sd 4:3

Configurations

Below are the default Sass configuration variables for seed-video. The variables can be found in the pack’s _config.scss file.

seed-video/_config.scss
// Namespaces
$seed-video-namespace: "c-video" !default;
$seed-video-embed-namespace: "#{$seed-video-namespace}__embed" !default;

// Config
$seed-video-background-color: #eee !default;
// Pass in ratios for w:h
$seed-video-sizes: (
  u-wide: (
    width: 21,
    height: 9
  ),
  // Golden ratio (16:10)
  gr: (
    width: 16,
    height: 10
  ),
  wide: (
    width: 16,
    height: 9
  ),
  sd: (
    width: 4,
    height: 3
  )
) !default;