简体   繁体   中英

Change the MIME type in WordPress

I am using JW Player plugin from wordpress. I try to upload mp4 file in the admin dashboard -> media There is nothing problem in the uploading. but when i try to load the video in jw player of wordpress it loads only audio. When i try to upload the file it shows the mime type as video/quicktime but i uploaded the mp4 file and mime type should be video/mp4 Not sure why this should happen.

Here is the screenshot that i uploaded from my side

在此处输入图片说明

How to change the mime type as video/mp4. Is that anything in wordpress or in convertor?

Any one give me a suggestion to overcome this problem

Reg, vicky

To add additional MIME types, in function.php write the below code:

add_filter('upload_mimes', 'add_custom_mime_types');

function add_custom_mime_types($mimes) {
    return array_merge($mimes, array (
        'ac3' => 'audio/ac3',
        'mpa' => 'audio/MPA',
        'flv' => 'video/x-flv',
        'svg' => 'image/svg+xml'
    ));
}

To remove existing MIME types:

add_filter('upload_mimes', 'remove_mime_types');

function remove_mime_types($mimes) {
    unset($mimes['mp4']);
}

You can also add the video/mp4 mime type via .htaccess

Sample:

<IfModule mod_rewrite.c>
  AddType video/ogg .ogv
  AddType video/webm .webm
  AddType video/mp4 .mp4
</IfModule>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM