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.

react-player not working with react server side rendering

See original GitHub issue

Hi, trying to render server side a simple component that uses react-player and it doesn’t seem to be working.

Route handler looks like this:

const ServerPost = (props) => (
          <ReactPlayer url='https://www.youtube.com/watch?v=ysz5S6PUM-U' playing />
        );
        var html = ReactDOMServer.renderToString(
          React.createElement(ServerPost, post),
        );
        reply(html);

DOM element looks like this: image

<div style="width:640px;height:360px;" data-reactroot="" data-reactid="1" data-react-checksum="-1272364945">
   <div style="height:100%;display:block;" data-reactid="2">
      <div id="youtube-player-0" data-reactid="3"></div>
   </div>
</div>

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
danmocommented, Oct 18, 2016

Hi @CookPete , shouldn’t the iframe be added to the generated html then ?

0reactions
j4-mcommented, May 19, 2022

Hey @cookpete I know this is a reeeeeeally old issue however I do think that a lack of basic SSR is a problem. For sites which use the video thumbnail for their LCP then CSR of the background-image is going to result in massive performance problem. Would you be willing to accept a PR which adds SSR support for the preview\thumbnail markup?

Read more comments on GitHub >

github_iconTop Results From Across the Web

react-player not working with react server side rendering #113
Hi, trying to render server side a simple component that uses react-player and it doesn't seem to be working. Route handler looks like...
Read more >
Is react-html5video is compatible with server side rendering ...
It seems the package is indeed not compatible with SSR. You could try to lazy-load your Player component on the client side with ......
Read more >
ReactPlayer - Best of JS
A React component for playing a variety of URLs, including file paths, YouTube, Facebook, Twitch, SoundCloud, Streamable, Vimeo, Wistia, Mixcloud, DailyMotion ...
Read more >
react-player | Yarn - Package Manager
A React component for playing a variety of URLs, including file paths, YouTube, Facebook, Twitch, SoundCloud, Streamable, Vimeo, Wistia and DailyMotion.
Read more >
react-player - npm
A React component for playing a variety of URLs, including file paths, YouTube, Facebook, Twitch, SoundCloud, Streamable, Vimeo, Wistia and ...
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