6

I want to add and play custom video where product images are display. Can any one help me?

0
 <script>
        require([
            'jquery',
            'mage/gallery/gallery',
        ], function ($, gallery) {


            $('[data-gallery-role=gallery-placeholder]').on('gallery:loaded', function () {

                // $(this).on('fotorama:ready', function () {

                    var api = $(this).data('gallery');

                    api.fotorama.data.push({
                       videoUrl: '',
                       video: {
                          id: video.id,
                          p: 'https://',
                          s: '',
                          type: 'video.com',
                       },
                       src: video.url,
                       img: video.thumbnail,
                       isMain: false,
                       thumb: video.thumbnail,
                       type: 'video',
                       caption: 'caption'
                    });
              // });
          });
</script>

There is also a function in lib/web/fotorama/fotorama.js which you probably have to overwrite:

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

For reference: https://devdocs.magento.com/guides/v2.2/javascript-dev-guide/widgets/widget_gallery.html

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.