Can't pass existing player to Vimeo.Player constructor if it's inside of other iframe
See original GitHub issueHi!
I have an application that serves Vimeo videos as advertising through DoubleClick For Publishers. So I have the Doubleclick’s iframe and inside of it the Vimeo’s iframe.
I know that this is a rare case, but I need some help… It seems that the Vimeo.Player constructor doesn’t accept an element that is inside of other iframe. The player.js returns this error message:
You must pass either a valid element or a valid id.
Here is a fiddle that reproduces the error.
To make this error reproducible, I had to create another fiddle with just the Vimeo’s iframe and use it on the <iframe>
tag of the first fiddle. I know that this is confusing, but feel free to ask anything.
Thanks!
Issue Analytics
- State:
- Created 7 years ago
- Comments:9 (5 by maintainers)
Top Results From Across the Web
vimeo/player/README.md - UNPKG
// If you want to control the embeds, you'll need to create a Player object. 93, // You can pass either the `<div>`...
Read more >Player SDK: The Basics - Vimeo Developer
If your web page already contains an embedded Vimeo player, you can access the player through the SDK by passing the player element...
Read more >Uncaught TypeError when posting and receiving from iframe ...
But when I click the link to trigger the popup with the Vimeo iframe inside, it throws this error: *The player element passed...
Read more >YouTube Player API Reference for iframe Embeds
The IFrame player API lets you embed a YouTube video player on your website and control the player using JavaScript. Using the API's...
Read more >Player parameters overview – Help Center - Vimeo
Parameter Supported Values Default Value
autopause true , false. OR. 1,0 true
autoplay true , false. OR. 1,0 false
background true , false. OR. 1,0 false...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@bdougherty We’ve been trying to use the Vimeo player for HTML elements inside an iframe, though in our case, the iframe is actually just a separate rendering target that we use to isolate styles and support multiple visible selections in different browsing contexts (via react-frame-component).
I made a PR (#180) that modifies the
isDomElement
check discussed in this thread to make it work across iframes and modifies themessage
addEventListener/attachEvent
listeners to be attached to the relativewindow
object of the player’s root HTML element rather than the globalwindow
object.Those changes make the player and its controls work, at least for our setup.
I am also facing exactly the same issue. Is there any resolution for the same?