Player from Vimeo does not work on any version. TypeError: Cannot read property 'Player' of undefined at Vimeo.js
When I try to import the React-player component with a Vimeo video I get the following error:
Uncaught (in promise) TypeError: Cannot read property 'Player' of undefined
at Vimeo.js:102
I verified that one of the possible causes of the error is to pass the parameter controls as true in case Vimeo videos do not have this feature enabled. I checked here: https://github.com/CookPete/react-player/issues/690
So, my component looks like this:
<ReactPlayer
className='react-player-div'
url={`https://vimeo.com/243556536`}
controls={false}
config={{vimeo:{ playerOptions: { controls: false }}}}
playing
style={{width:'100%',height:'100%'}}
/>
But I still get this error.
- URL attempting to play: https://vimeo.com/243556536
- Browser: Chrome 80
- Operating system: macOS Mojave 10.14.6
Managed to solve? I have the same problem.
No, still waiting for a solution :/ ...
I'm having issues as well. But in my case, I'm trying to pass the link as a props, it renders just a black background and I don't get any console error.
<ReactPlayer
url={link}
onPause={exitFullscreen}
onEnded={exitFullscreen}
config={{
vimeo: {
playerOptions: { autopause: true },
preload: true,
},
}}
controls
height="auto"
width="100%"
/>
It works for the Youtube link, but it completely ignores Vimeo's

Same here
I've tested with some different Vimeo links, and nothing...ended up that I needed to make like
url={link.trim()}
but that wasn't a problem for Youtube...well, anyway...I hope this silly solution helps someone.
We temporarily switched to react-vimeo
{video.url.includes('vimeo.com') ? (
<ReactVimeo video={video.url} className='vimeo' />
) : (
<ReactPlayer url={video.url} key={index} width='auto' />
)}
Has anyone tried the solution from https://github.com/CookPete/react-player/issues/690#issuecomment-520415076 and loaded the Vimeo API before any other script?
<script type="text/javascript" src="https://player.vimeo.com/api/player.js"></script.
It seems like the Vimeo API is causing this error when define is in the global scope when the API is loaded.
I've tried that @CookPete , before the .trim() solution, but it did not work for me.
Now I have this error for Youtube videos
Failed to execute 'postMessage' on 'DOMWindow': The target origin provided ('https://www.youtube.com') does not match the recipient window's origin ('http://localhost:3000').
even if the link is https://
Unless someone can prove with a rock solid example that this is a problem with ReactPlayer and not just a weird quirk with the Vimeo player API, I'm not sure what I can do here.
Now I have this error for Youtube videos
@danihazler This has been covered many times before: https://github.com/CookPete/react-player/issues/875 https://github.com/CookPete/react-player/issues/508 https://github.com/CookPete/react-player/issues/96
I looked a bit into this, I don't have the bandwidth/resources to fix this, but the problem seems to occur when requirejs is used, which will correctly cause the video player script to not add the Player object to globalThis.
See the first few lines.
/*! @vimeo/player v2.21.0 | (c) 2024 Vimeo | MIT License | https://github.com/vimeo/player.js */
!function(e, t) {
"object" == typeof exports && "undefined" != typeof module ? module.exports = t() : "function" == typeof define && define.amd ? define(t) : ((e = "undefined" != typeof globalThis ? globalThis : e || self).Vimeo = e.Vimeo || {},
e.Vimeo.Player = t())
}(this, function() {
"use strict";
function r(t, e) {
...
Which means that instead of the getSDK function https://github.com/cookpete/react-player/blob/141b84393c07cf1d0c8b596cde5217afe7ccb044/src/utils.js#L86 assuming the Vimeo object is passed to the globalThis/window object, it should use sth like
require([url], (module) => {
onLoaded(module)
})
Since the Player object goes via the requirejs system.
A (very) dirty workaround is to do:
delete requirejs.amd
Which will bypass using requirejs.