Is there a way to add HTML video instead of relying on Youtube, Vimeo, ... It's kinda unprofessional looking and it's not kinda hard to have a video tag that links to URL. Seems like this is supported as a Magento Commerce feature from documentation, I should be able to allow my own CDN link to do this kinda stuff. Seems like a very simple feature left out intentionally which looks bad on an open-source project

  • You want to add mp4 video? – Pushpendra Singh Jun 27 '20 at 2:35
  • yes, either by uploading or dropping a link from a CDN storage like AWS or Google cloud – MKoosej Jun 27 '20 at 18:23

You can add a video by edit some code in below plugin


You need to add below code in di.xml file, file location etc/adminhtml/di.xml

<item name="mp4" xsi:type="string">video/mp4</item>

For video tag, you need to add below code in this file Controller/Adminhtml/Wysiwyg/Images/OnInsert.php after this line

$image = $helper->getImageHtmlDeclaration($filename, $asIs);

/*Replace mp4 video attribute src to video */
  $defaultFileTypes = array('mp4');
  foreach($defaultFileTypes as $a){
      if (strpos($image, $a) !== false) {
            $image= str_replace("img", 'video width="320" height="240" controls', $image);
            $image= str_replace("/>", '>', $image);
  • thanks for the answer, I'll give it a try to verify it – MKoosej Jun 27 '20 at 18:22
  • is there a way to do the change in Controller/Adminhtml/Wysiwyg/Images/OnInsert.php in your own theme or module file? that way I need to have the whole file with your snippet added, right? – MKoosej Jun 30 '20 at 8:32
  • Did you able to find the file? – Pushpendra Singh Jun 30 '20 at 9:17
  • yes, it's in ./vendor/magento/module-cms/Controller/Adminhtml/Wysiwyg/Images/OnInsert.php , it's not recommended to edit files in vendor files cause composer would replace it – MKoosej Jun 30 '20 at 9:24
  • nvm, I think I found it in the same module and edited it – MKoosej Jun 30 '20 at 10:18

It's not recommended to host videos on your server as it may consume resources and large storage from your server, this is why even large ecommerce depends on 3rd party video providers to embed required videos. Youtube embedded videos give you the ability to style the embedded video so that you can style it according to your website design

However, if you decide to add videos manually, the easiest way to link videos to products is by using product custom attributes provided by magento, where you will save the video location as a string and call it whenever necessary.

  • does this mean I need to customize the theme to use that string in the video tag? – MKoosej Jun 22 '20 at 8:55

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.