Vignesh Pichamani
Vignesh Pichamani

Reputation: 8070

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

enter image description here

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

Upvotes: 1

Views: 3989

Answers (2)

Arshad Hussain
Arshad Hussain

Reputation: 777

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']);
}

Upvotes: 4

emaxsaun
emaxsaun

Reputation: 4201

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>

Upvotes: 1

Related Questions