Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Light mode + responsive videos + styled components - any pointers? #584

Closed
hanno-jonlay opened this issue Mar 3, 2019 · 1 comment
Closed

Comments

@hanno-jonlay
Copy link

I've got the component working smoothly and integrated with styled-components to set up the responsive player.

import React from 'react'
import ReactPlayer from 'react-player'
import styled from 'styled-components'

const VideoWrapper = styled.div`
  position: relative;
  padding-top: 56.25%; /* Player ratio: 100 / (1280 / 720) */
`
const Video = styled(ReactPlayer)`
  position: absolute;
  top: 0;
  left: 0;
`
function VideoEmbed({ url }) {
  return (
    <VideoWrapper>
      <Video width="100%" height="100%" url={url} />
    </VideoWrapper>
  )
}

export default VideoEmbed

My problem is that while styling works nicely without light mode, as soon as this parameter is passed, we run into styling issues:

image

I see how you describe how to override the .react-player__preview classes and similar in the documentation, but can't see how to easily implement that in this situation.

I suspect this is my own inexperience with styled-components (which I'm relatively new to) - wondering if you have any quick pointers for achieving the required effect without resorting to a class inside a global CSS file, or replicating the light mode myself.

@hanno-jonlay
Copy link
Author

Thanks @cookpete - works nicely! Appreciate you taking the time to figure out a fix.

albanqoku added a commit to albanqoku/react-player that referenced this issue Feb 24, 2021
Webmaster1116 added a commit to Webmaster1116/video-player that referenced this issue May 20, 2021
webmiraclepro added a commit to webmiraclepro/video-player that referenced this issue Sep 9, 2022
philip-luther added a commit to philip-luther/react-player that referenced this issue Nov 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant