player.js: Percentage values for width and height are not set correctly

Expected Behavior

Passing in width and height options as 100% should set the iframe width and height attributes to 100%

Actual Behavior

The iframe width and height attributes are set to just 100, which is interpreted by browsers as 100px

Steps to Reproduce

new Vimeo.Player(90509568, {
  width: '100%',
  height: '100%'
})

Produces something like the following:

<iframe src="https://player.vimeo.com/video/90509568" width="100" height="100"></iframe>

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 17
  • Comments: 18 (8 by maintainers)

Most upvoted comments

Well this works for me! Not sure why no one answered this:

const player = new Player( 'theVideo', {
	id: 59777392,
	responsive: true
});

@rsichel107 why has this been closed? It’s an old issue but still a problem as far I can see. The ideas posted (setting iframe height and width after the fact) seem like workarounds and not an actual solution.

OK That’s not a problem for me coz all my videos are of the same aspect ratio and size.

See #54 for the responsive embed code issue.