0

I am trying to add Vimeo video on Magento's product details page, so initially while adding video from admin I was getting error as "Video not found" so I applied the solution given at:

https://github.com/magento/magento2/pull/31767/files

Then still my video was not displaying on front end so I applied the solution from here:

https://community.magento.com/t5/Magento-2-x-Technical-Issues/BUG-Magento-2-2-2-Fotorama-Videos-Not-Loading/td-p/90429

Now when I checked it loads the video thumbnail with Play icon but clicking on play gives an error as per screenshot:

Vimeo Video Error

After more debugging I found that the URL generated for iframe to load video is something like this:

http://vimeo.com/embed/videoid

Which won't work, as it should be

https://player.vimeo.com/video/videoid

If I use this url by changing iframe source manually on loaded page, it works fine, but I am not sure form where Magento is generating that embed url which is not working, tried searching load-player.js file in Magento_ProductVideo , tried searching fotoroma js files also, and other folder I could think of, but nothing helped.

3
  • awaiting expers comment Jul 26 at 5:33
  • have you check the console, is there any error there? Jul 27 at 4:11
  • the only error I see is that it cant load content from vimeo.com because of cross origin policy, but thats obvious as vimeo has stopped serving content on its primary url for video embedding and it only allows the same if called using url player.vimeo.com Jul 27 at 6:39
0

I got to solve this by editing file:

/lib/web/fotorama/fotoram.js

by replacing this piece of code at approx line no. 1080:

function createVideoFrame(videoItem) {
        var frame = '<iframe src="' + videoItem.p + videoItem.type + '.com/embed/' + videoItem.id + '" frameborder="0" allowfullscreen></iframe>';
        return frame;
    }

with this one:

function createVideoFrame(videoItem) {
        var frame = '';
        if(videoItem.type == 'vimeo'){
            frame = '<iframe src="https://player.vimeo.com/video/' + videoItem.id + '" frameborder="0" allowfullscreen></iframe>';  
        } else {
           frame = '<iframe src="' + videoItem.p + videoItem.type + '.com/embed/' + videoItem.id + '" frameborder="0" allowfullscreen></iframe>';
        }
        return frame;
    }

I know its a core hack but I am sure Magento's people will soon update the core as Vimeo has stopped video embedding on its primary domain.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.