react-youtube
react-youtube copied to clipboard
don't recreate the player for video changes
I am not sure why the player is being reset when the videoId changes. That case is already handled by shouldUpdateVideo as far as I can tell. I tested my change in Firefox and Google Chrome and switching the video still works as expected.
The check has been introduced in https://github.com/tjallingt/react-youtube/pull/284 but I did not find any reason for it there.
Without this change the player automatically leaves fullscreen on video changes which is undesirable for me. Additionally to that, fullscreen can't then be resumed in Google Chrome, because the youtube player believes it is still fullscreened (https://github.com/iyzana/vsync/issues/53).
This pull request is automatically built and testable in CodeSandbox.
To see build info of the built libraries, click here or the icon next to each commit SHA.
Latest deployment of this branch, based on commit ea68cdcda2c03fcf2e45b121bc822647c0f507f9:
| Sandbox | Source |
|---|---|
| react-youtube-example | Configuration |
In the codesandbox the change can be seen when clicking "Change video". Without this change the player fades to white for a bit, with this change only the video itself is updated which is quite a bit faster.