Private vimeo videos not working
eduwass opened this issue · comments
Hi,
It looks like private vimeo videos that contain the 'h' parameter in the URL, do not work.
See similar issue here:
sampotts/plyr#2321
Hacked around for a fix:
let videoParams = [];
// Extract video parameters
document.querySelectorAll('.ghostkit-video').forEach(videoDiv => {
let videoUrl = new URL(videoDiv.getAttribute('data-video'));
videoParams.push({
id: videoUrl.pathname.split('/')[2],
hParam: videoUrl.searchParams.get('h')
});
});
// MutationObserver for the iframe update
new MutationObserver(mutations => {
mutations.forEach(mutation => {
let iframe = mutation.target.querySelector('.ghostkit-video-fullscreen iframe');
if (iframe) {
let vimeoID = new URL(iframe.src).pathname.split('/')[2];
let param = videoParams.find(p => p.id === vimeoID);
if (param) {
iframe.src = new URL(iframe.src).origin + '/video/' + vimeoID + '?h=' + param.hParam;
}
}
});
}).observe(document.body, { childList: true, subtree: true, attributes: true });
But it would be amazing if this chould be fixed in the core of the plugin, thanks!
Thanks for your work on this! 👍
Fixed in the dev build, will be released soon.