I have added wyswing editor in my custom module. From there, I want to allow to upload mp4 video from that editor.
How can I do that?
Any one please help me.
2 Answers 2
You should override the Storage type using the di.xml. Here is example for PDF. Then upload a new type of media should be possible via storage.
<type name="Magento\Cms\Model\Wysiwyg\Images\Storage">
 <arguments>
 <argument name="extensions" xsi:type="array">
 <item name="allowed" xsi:type="array">
 <item name="jpg" xsi:type="string">image/jpg</item>
 <item name="jpeg" xsi:type="string">image/jpeg</item>
 <item name="png" xsi:type="string">image/png</item>
 <item name="gif" xsi:type="string">image/gif</item>
 <item name="pdf" xsi:type="string">application/pdf</item>
 </item>
 <item name="image_allowed" xsi:type="array">
 <item name="jpg" xsi:type="string">image/jpg</item>
 <item name="jpeg" xsi:type="string">image/jpeg</item>
 <item name="png" xsi:type="string">image/png</item>
 <item name="gif" xsi:type="string">image/gif</item>
 <item name="pdf" xsi:type="string">application/pdf</item>
 </item>
 <item name="media_allowed" xsi:type="array">
 <item name="flv" xsi:type="string">video/x-flv</item>
 <item name="avi" xsi:type="string">video/x-msvideo</item>
 <item name="mov" xsi:type="string">video/x-sgi-movie</item>
 <item name="rm" xsi:type="string">application/vnd.rn-realmedia</item>
 <item name="wmv" xsi:type="string">video/x-ms-wmv</item>
 <item name="pdf" xsi:type="string">application/pdf</item>
 </item>
 </argument>
 </arguments>
</type>
 - 
 can you please provide me example of mp4?Niket– Niket2021年03月29日 13:27:54 +00:00Commented Mar 29, 2021 at 13:27
 - 
 Replace application/pdf with video/mp4K. Maliszewski– K. Maliszewski2021年03月30日 13:05:26 +00:00Commented Mar 30, 2021 at 13:05
 - 
 3
 
Although I haven't done it with the video files, I have done some changes to wysiwyg in a project. Maybe I could guide you to the right direction.
Something to know as of Magento 2.3.x versions the TinyMCE have been upgraded to v4.
First of all you need to extend the TinyMCE, which you can find documentation here
In the plugin for Magento\Cms\Model\Wysiwyg\Gallery\DefaultConfigProvider in the function afterGetConfig you can include your custom configuration, which you can get from TinyMCE documentation. Here is the link for the media config.
- 
 can you please upload example with code?Niket– Niket2021年03月29日 13:27:25 +00:00Commented Mar 29, 2021 at 13:27