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

Facebook videos not fitting properly in the container #1071

Closed
sagarchoudhary96 opened this issue Nov 10, 2020 · 5 comments
Closed

Facebook videos not fitting properly in the container #1071

sagarchoudhary96 opened this issue Nov 10, 2020 · 5 comments

Comments

@sagarchoudhary96
Copy link

Current Behavior

While trying to play Facebook Video, in a modal using react-player, it's not taking the given height of the modal and sometimes based on video either overflows or is of less width resulting in non-uniform layout. The issue i think its because of the aspect-ratio maybe in which the Facebook returns iframe.

Rest all videos from youtube, Vimeo seems to be fitting properly taking the given height and width.

Expected Behavior

I want the video to fit in the given space in modal similar to how it happens on the facebook page.
Screenshot 2020-11-10 at 12 28 27 PM

Steps to Reproduce

I have created the sandbox for it where it can be tested.

  1. change the value of url in this object in NewVideoModal.js file
const defaultOptions = {
  url: testUrls[1],
  playing: true,
  controls: true,
  light: true
};

for 1st URL i.e youtube , it works fine, i need it to be similar for facebook links also.
for 2nd and 3rd URL from the testUrls array, you can see the issue. for 2nd URL the video overflow and controls are hidden. for 3rd URL the video is of lesser height than the container so extra padding at bottom can be seen.

Environment

@keslert
Copy link

keslert commented Nov 13, 2020

I'm also experiencing this issue. Here's another video that's problematic: https://www.facebook.com/JenniferGarner/videos/537638620452807/

@cookpete
Copy link
Owner

Looks like unless you pass in a pixel value to data-width and data-height of the Facebook embed, the player will expand beyond the height of the wrapper to match the aspect ratio of the video.

I'm going to add config.facebook.attributes so you can do something like

config={{
  facebook: {
    attributes: {
      'data-width': '320px',
      'data-height': '180px'
    }
  }
}}

to pin the size of the video when it is loaded by the FB SDK. I think using these attributes means players can no longer be responsive, but it's the best we can do.

@sagarchoudhary96
Copy link
Author

Thanks @cookpete for this fix. will test it out once.

Webmaster1116 added a commit to Webmaster1116/video-player that referenced this issue May 20, 2021
@MikeyS2002
Copy link

Is there something to make it responsive I've tried 'data-width': '100%', 'data-height': '100%' but that doesn't seem to work. Anyone an idea?

webmiraclepro added a commit to webmiraclepro/video-player that referenced this issue Sep 9, 2022
@dmrickey
Copy link

How does the linked commit resolve this?

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

5 participants