-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
The cdn version of Vimeo's player.js is not appropriate for a <script> tag on a require.js-using site #420
Comments
Might be worth raising this over at the player.js repo? |
@sampotts I've raised the above pull request for this issue. I'm not sure that that Vimeo would alter the CND'd version of their player.js for this. I think it could be related to this issue though: vimeo/player.js#36 I've implemented the above PR on a couple of Magento 2 sites, which heavily use require.js, and it thoroughly fixes the mentioned issue. |
Here's a Codepen which kind of clumsily illustrates the issue: http://codepen.io/jodi/pen/ObMjbM?editors=1010 |
FWIW I've opened an issue on Vimeo's repo too: vimeo/player.js#79 Sorry for the issue spam! |
This issue can be alleviated with a fix in the 'vimeoTimer' callback interval by checking for require and then load the CDN version using require if it's available: var vimeoTimer = window.setInterval(function() {
if (_is.object(window.Vimeo)) {
window.clearInterval(vimeoTimer);
_vimeoReady(mediaId, container);
} else if ("function" == typeof define && define.amd) {
require([
config.urls.vimeo.api
], function(player){
window.Vimeo = { Player: player };
_vimeoReady(mediaId, container);
});
window.clearInterval(vimeoTimer);
}
}, 50); |
If someone has issues with this (I'm not using require.js myself), a PR with an alternative method to load the URL is welcome. For example, you could detect if require.js exists globally and use it to load the URL instead of loadjs, like the solution above but in Plyr instead of a workaround. |
Expected behaviour
Vimeo videos should play correctly
Actual behaviour
A Mismatched Anonymous Define Modules error fires. More info on that error: http://requirejs.org/docs/errors.html#mismatch
Basically, the UMD in player.js is simply not necessary for embedding via a
script
tag.Environment
Steps to reproduce
The text was updated successfully, but these errors were encountered: