3

Is it is possible to add videos other than vimeo or youtube ?

If yes, how is it possible to add wistia to integrate in Magento and add videos in products?

1 Answer 1

3

Yes, it is possible to add custom videos to the product gallery section. You can directly override the Magento_Catalog/templates/product/view/gallery.phtml file to add custom videos.

Override the script as below code:

<script>
    require(['jquery'], function ($) {
        $(document).on('gallery:loaded', function () {
            var $fotorama = jQuery('div.gallery-placeholder > div.fotorama');
            var fotorama = $fotorama.data('fotorama');
            $fotorama.on('fotorama:load', function fotorama_onLoad(e, fotorama, extra) {
                if (extra.frame.type === 'iframe') {
                    extra.frame.$stageFrame.html('<iframe align="middle" type="text/html" width="100%" height="100%" src="' + extra.frame.src + '" frameborder="0" scrolling="no" allowfullscreen webkitallowfullscreen mozallowfullscreen oallowfullscreen msallowfullscreen></iframe>');
                }
            });
            fotorama.push({
                thumb: '<set your thumbnail image path>',
                'src': '<set your video url>',
                type: 'iframe',
                caption: '<set your caption>'
            });
        });
    });
</script>

I have refered this code from the following link: https://www.magedelight.com/resources/how-to-add-custom-product-video-in-fotorama-gallery/

It seems the script directly added in template file. For a better coding standard you can add this script as a separate JS file.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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