1.0.2 • Published 1 year ago

vimeo-embed-cover v1.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

vimeo-embed-cover

View code coverage on codecov

A utility to scale a Vimeo embed to fill an element regardless of aspect ratio.

Vimeo embeds letterbox to fit within their embedding iframe (equivalent to CSS's object-fit: contain). This utility dynamically scales up the embed to fill the container with the video content and hiding the letterboxing (equivalent to object-fit: cover).

Usage

Initialise a Vimeo Player, then pass the Player instance into the utility function:

import vimeoEmbedCover from 'vimeo-embed-cover';

const player = new Vimeo.Player(/* ... */);
vimeoEmbedCover(player);

The player's <iframe> element will be resized & repositioned within its parent.

As the positioning is configured via CSS, the player's containing element (the element passed in to new Vimeo.Player(element)) must also have position: relative or position: absolute set.


MIT License

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago