question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Responsive `width`

See original GitHub issue

Hi, Is it possible to make the <ReactPlayer> width responsive? For example to inherit the width of the div or td in which is placed? Thanks

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:11 (5 by maintainers)

github_iconTop GitHub Comments

64reactions
cookpetecommented, Jan 26, 2017

You should be able to pass 100% to the width and height props and it will fill it’s container. If you want responsive width and aspect ratio, do something like this:

.wrapper {
  position: relative;
  padding-top: 56.25% /* Player ratio: 100 / (1280 / 720) */
}

.player {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}
<div className='wrapper'>
  <ReactPlayer
    className='player'
    playing
    url={...}
    width='100%'
    height='100%'
  />
</div>
9reactions
cookpetecommented, Jan 18, 2018

This would be very helpful to include in the README.

Nearly a year late but it’s finally in there: https://github.com/CookPete/react-player#responsive-player 😞

Read more comments on GitHub >

github_iconTop Results From Across the Web

Responsive CSS Width - DEV Community ‍ ‍
Basically, we're saying the container element should have a width of 1200px but at no point should it exceed the maximum width of...
Read more >
HTML Responsive Web Design - W3Schools
Responsive images are images that scale nicely to fit any browser size. Using the width Property. If the CSS width property is set...
Read more >
Responsive web design basics
To attempt to provide the best experience, mobile browsers render the page at a desktop screen width (usually about 980px , though this...
Read more >
Responsive design - Learn web development | MDN
To ensure media is never larger than its responsive container, the following approach can be used: img, picture, video { max-width: 100%; }...
Read more >
5. min width and max width - Responsive CSS Tutorial
This tutorial is a part of "The Responsive Web Design Bootcamp" on Scrimba. Explore the full course here: ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found