I know that, we can upload video via Vimeo and Youtube video url in the product from admin.

However I cannot find a way to directly upload video file same as product image.

Does this means that I cannot host product video in my Magento server?


4 Answers 4


As an alternative solution, if you don't want to use YouTube or Vimeo, upload file directly in to your server, and using browser native html video tag, you can insert video manually. Just simple example bellow, inside product page description.

<video width="480" controls>
  <source src="/pub/media/video/your-video-file.mp4" type="video/mp4">
  • Hi @crashtestxxx, your solution is for displaying video in product detail page in either description or in tabbing section but if i want to display inside Product Image gallery (fotorama gallery), do you have any idea how to do with this for configurable product.
    – Rik Patel
    Jul 15, 2020 at 7:41
  • @NayanBaraiya As of this moment, Magento 2 supports only YouTube and Vimeo video uploads. To be able to upload and host video files on same server and be used with build in Magento 2 gallery, you will need to write module extension. Instead, if YouTube and Vimeo is not an option, I would suggest just purchase ready to install module, it will save you time and frustrations. Jul 18, 2020 at 18:39
  • Can you suggest any extension for this ?
    – Rik Patel
    Jul 23, 2020 at 9:44

If Display video in product page using mp4 video and another types of video

We have to need create attribute for add video name

Then get this video name to where want to display video

    $_helper = $this->helper('Magento\Catalog\Helper\Output');
    $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
    $_product = $objectManager->get('Magento\Framework\Registry')->registry('current_product');//get current product

<?php if($proVideo = $_helper->productAttribute($_product,$_product->getVideoName(), 'video_name')):?>
    <?php $videoUrl = $this->getUrl('pub/media/catalog/product/videos/').$proVideo; ?>
    <div class="prod_video_bg">
        <video width="400" controls>
          <source src="<?php echo $videoUrl; ?>" type="video/mp4">
<?php endif; ?>  
  • its not working Nov 18, 2019 at 6:45
  • whats problems and face error explain in brief Nov 18, 2019 at 6:50
  • i have add this code video link its not getting my phtml page Nov 18, 2019 at 6:54
  • $proVideo = $_helper->productAttribute($_product,$_product->getVideoName(), 'video_name') Ru u not geeting this value right ? Nov 18, 2019 at 6:56
  • value not display in this page NULL value Nov 18, 2019 at 7:18

This extension might be useful https://webkul.com/blog/magento2-product-video/


Yes, you can only upload video to Magento 2 product via YouTube or Vimeo.

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.